-
Notifications
You must be signed in to change notification settings - Fork 804
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Golint is borderline abandonware (all that energy seems to be on `go vet` instead), and doesn't even ignore vendor folders from `./...` despite [having a github issue since 2017](golang/lint#320). Plus it's non-configurable by design, which IMO encourages some bad habits. See the next commit for details. After a brief skim of the current state of things, `revive` popped out as a possibility, and the results are pretty good. Runtimes on a fairly beefy machine: ```sh # time make lint (before) make lint 8.80s user 13.14s system 154% cpu 14.206 total # time make lint (simply swapping bins) make lint 10.85s user 16.89s system 149% cpu 18.545 total # time make lint (new call) make lint 21.72s user 4.22s system 2555% cpu 1.015 total ``` So that's a **14x reduction** in runtime, and now it's at the point where it's fine to run all the time (~1 second). Locally, perhaps due to having fewer cores, this goes from 14s -> 2s. Still substantially better, and still comfortably fast. This default list also finds an additional 14 items, none major, and they basically match newer `golint` versions / what IDEs will often highlight: ``` # new lint, potentially worth following. # there are many instances of this in the canary/ folder, but this was ignored earlier, so it is ignored now as well. service/worker/failovermanager/starter.go:91:9: [context-keys-type] should not use basic type string as key in context.WithValue # new lint, potentially worth following service/worker/scanner/shardscanner/scanner_workflow.go:176:2: [if-return] redundant if ...; err != nil check, just return error instead. # 3 new comment-formatting / exported-type-without-comment additions ``` Nothing significant, but (ignoring the new comment lints) possibly worth tackling, and not excessively noisy. The following commits add some new lints + fixes, this one just aims for parity.
- Loading branch information
Showing
6 changed files
with
58 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# config for https://github.com/mgechev/revive | ||
ignoreGeneratedHeader = false | ||
severity = "warning" | ||
confidence = 0.8 | ||
errorCode = 0 | ||
warningCode = 0 | ||
|
||
#### roughly what golint does. probably only disable noisy ones. | ||
|
||
[rule.blank-imports] | ||
[rule.context-as-argument] | ||
[rule.context-keys-type] | ||
[rule.dot-imports] | ||
[rule.error-naming] | ||
[rule.error-return] | ||
[rule.error-strings] | ||
[rule.errorf] | ||
[rule.exported] | ||
[rule.if-return] | ||
[rule.increment-decrement] | ||
[rule.indent-error-flow] | ||
[rule.package-comments] | ||
[rule.range] | ||
[rule.receiver-naming] | ||
[rule.time-naming] | ||
[rule.unexported-return] | ||
[rule.var-declaration] | ||
[rule.var-naming] | ||
|