move "vet" checks from golangci-lint to nogo #9671
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Nogo is
rules_go
's way of linting go code. It runs during compilation, and only during compilation. This means that lint results are cached along with compiled libraries, so if a library isn't being compiled, you don't have to spend time linting it.Moving govet is the easiest linter. I plan to gradually chip away at everything that golangci-lint does, but for now, we're just getting the simplest one.
(Additionally, this makes bazel builds behave more like go builds. Go runs vet whenever you request a test, and won't run the test if vet fails. This doesn't happen with Bazel, but golangci-lint would have gotten it. Now it works again, and also affects non-test targets, which I think is helpful.)
We also gain the ability to write our own lint rules: https://github.com/bazelbuild/rules_go/blob/master/go/nogo.rst#writing-and-registering-analyzers