Description
Current behavior:
If you have any file with a build tag, e.g. // +build integration
or others, files under that tag won't be checked unless you explicitly pass them manually by using:
run:
build-tags:
- integration
Or the corresponding --build-tags
flag.
I've been using golangci-lint for the past few months and didn't noticed this behavior until now. I have a lot of tests against a DB marked as // +build integration
and thus, weren't being checked by golangci-lint.
In addition I think it's easy to forget to modify golangci-lint config everytime you add a new tag to your code, resulting in a lot of bad formatted, unchecked files.
Proposal:
Using https://golang.org/pkg/go/parser/ or some other tool (I would have to investigate further), to discover all the build tags present on the project, extracting a list.
The proposed golangci-lint behaviour would enable by default all build tags (or at least have a new enable-all
property for backwards compatibility purposes), being able to disable individual checks as you wish.
This way, you can keep a sane synced config even if you modify your code or add new tags to it without having to modify golangci-lint config every time.
What do you think @jirfag ?