-
-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
golangci-lint: Upgrade, fix issues, reconfigure
The golangci-lint being used was quite dated. This change upgrades to the latest version. Unfortunately, that's not sufficient. The new list comes with a bunch of new linters. 'enable-all' is a difficult target to keep up with, and will just litter code with a bunch of `//nolint` comments or a bunch more exclusions. Not all linters that come with golangci-lint have value. As a fix, I've switched the golangci.yml to an opt-in list of linters. We get the golangci-lint defaults (errcheck, gosimple, govet, ineffassign, staticcheck, unused), and add a few useful ones on top of it. I tried to guess the linters that were being used from the existing configuration and `//nolint` comments, and made sure others I know are good are in there. Note on revive: I've included an opt-out for unused parameters for revive because turning `newThing(required bool)` to `newThing(_ bool)` is a loss of useful information. The changes to the Go files are to fix the following issues: ``` camelcase.go:16: File is not `gofmt`-ed with `-s` (gofmt) config_test.go:50:18: directive `//nolint: gosec` is unused for linter "gosec" (nolintlint) defaults_test.go:28:25: G601: Implicit memory aliasing in for loop. (gosec) doc.go:5: File is not `gofmt`-ed with `-s` (gofmt) kong.go:446:18: directive `//nolint: gosec` is unused for linter "gosec" (nolintlint) kong_test.go:503:20: G601: Implicit memory aliasing in for loop. (gosec) model.go:493:10: composites: reflect.ValueError struct literal uses unkeyed fields (govet) scanner.go:112: File is not `gofmt`-ed with `-s` (gofmt) ``` And to address broken nolint directives reported as follows by golangci-lint. ``` [.. skipped .. ] tag.go:65:1: directive `// nolint:gocyclo` should be written without leading space as `//nolint:gocyclo` (nolintlint) tag.go:206:51: directive `// nolint: gocyclo` should be written without leading space as `//nolint: gocyclo` (nolintlint) util_test.go:23:43: directive `// nolint: errcheck` should be written without leading space as `//nolint: errcheck` (nolintlint) util_test.go:51:22: directive `// nolint: errcheck` should be written without leading space as `//nolint: errcheck` (nolintlint) ``` If you'd prefer 'enable-all', feel free to close this PR.
- Loading branch information
Showing
24 changed files
with
121 additions
and
127 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
File renamed without changes.
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 |
---|---|---|
@@ -1 +1 @@ | ||
.golangci-lint-1.46.2.pkg | ||
.golangci-lint-1.55.2.pkg |
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
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
Oops, something went wrong.