3 ms·
First, I recommend golangci-lint [1], just because it's much more performant (and designed to be from the start) than gometalinter. It uses much of the same cod
by atombender 8y ago
First, I recommend golangci-lint [1], just because it's much more performant (and designed to be from the start) than gometalinter. It uses much of the same code.
Some of the more useful linters, like deadcode, can be a little too slow to run in an editor like VSCode. We run the full linter list as part of our CI tests, and then in development we run it with "--fast", which runs only the fastest one. I've disabled megacheck, which didn't work with Go modules the last time I tried it.
Among the prominent ones I use, all enabled by fast mode, are ineffassign (as mentioned),
deadcode (detects unused code), govet (runs "go vet"), errcheck (checking for calls where you ignore the error result),
structcheck (finds unused struct fields), varcheck (finds unused variables and constants), typecheck (this does the same thing as "go build", basically), and unconvert (detects unnecessary type conversions). The slower ones that are worth turning on are staticcheck (performs lots of static checks) and unused (checks for unused variables etc., but is slower than varcheck and structcheck, apparently).
[1] https://www.github.com/golangci/golangci-lint https://www.github.com/golangci/golangci-lint
- sickcodebruh 8y agoThank you! This is great. For all of Go’s warts, it lived up to every single hope and expectation I had for it in this last project. I’m looking forward to improving it with these suggestions.