-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exclude modules with init() in tests from includes lists #12650
Conversation
@@ -33,7 +33,6 @@ import ( | |||
_ "github.com/elastic/beats/packetbeat/protos/nfs" | |||
_ "github.com/elastic/beats/packetbeat/protos/pgsql" | |||
_ "github.com/elastic/beats/packetbeat/protos/redis" | |||
_ "github.com/elastic/beats/packetbeat/protos/tcp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this was doing nothing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, it has an init on its tests.
if err != nil { | ||
log.Fatal("Failed checking for .go files in package dir: %v", err) | ||
} | ||
if len(goFiles) == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this was used as a sanity check with the assumption that anything using this code should find at least one thing to import. Maybe we should add this check after the for loop completes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed this check because at the end if there are no go files then foundInitMethod
is never going to be true
.
jenkins, test this again please |
Tool that collects modules for the includes lists checks only
include packages that have an init method, but it can also
include packages whose inits methods are defined only in
tests. Exclude these packages from the list.
This is required to do go tests in modules without code as
filebeat modules or metricbeat light modules (#12270).