Skip to content

Commit

Permalink
Exclude modules with init() in tests from includes lists (elastic#12650)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoriano authored Jun 25, 2019
1 parent ea09745 commit 7a6f8d5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
17 changes: 8 additions & 9 deletions dev-tools/cmd/module_include_list/module_include_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,18 @@ func main() {
// Build import paths.
var imports []string
for _, dir := range dirs {
// Skip dirs that have no .go files.
goFiles, err := filepath.Glob(filepath.Join(dir, "*.go"))
if err != nil {
log.Fatal("Failed checking for .go files in package dir: %v", err)
}
if len(goFiles) == 0 {
continue
}

// Skip packages without an init() function because that cannot register
// anything as a side-effect of being imported (e.g. filebeat/input/file).
var foundInitMethod bool
goFiles, err := filepath.Glob(filepath.Join(dir, "*.go"))
if err != nil {
log.Fatalf("Failed checking for .go files in package dir: %v", err)
}
for _, f := range goFiles {
// Skip test files
if strings.HasSuffix(f, "_test.go") {
continue
}
if hasInitMethod(f) {
foundInitMethod = true
break
Expand Down
1 change: 0 additions & 1 deletion packetbeat/include/list.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7a6f8d5

Please sign in to comment.