Skip to content

Commit

Permalink
fix exclude filters only working for directories
Browse files Browse the repository at this point in the history
  • Loading branch information
xrstf committed May 3, 2021
1 parent bee660e commit e51cef8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ func loadConfiguration(filename string, moduleRoot string) (*Config, error) {
// to not muck with generated files
"**/zz_generated.**",
"**/zz_generated_**",
"**/generated.pb.go",
"**/*_generated.go",

// for performance
".git/**",
Expand Down
12 changes: 8 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,17 @@ func listFiles(start string, moduleRoot string, skips []string) ([]string, error
return err
}

if d.IsDir() {
for _, skip := range skips {
if match, _ := doublestar.Match(skip, relPath); match {
for _, skip := range skips {
if match, _ := doublestar.Match(skip, relPath); match {
if d.IsDir() {
return filepath.SkipDir
} else {
return nil
}
}
} else if strings.HasSuffix(path, ".go") {
}

if !d.IsDir() && strings.HasSuffix(path, ".go") {
result = append(result, path)
}

Expand Down

0 comments on commit e51cef8

Please sign in to comment.