-
Notifications
You must be signed in to change notification settings - Fork 305
build: Update golangci-lint to v2.0.2 #3488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
- Don't capitalize error strings. - Ensure comments match field/func names. - Simplify a switch statement by naking it non-naked.
"gosec" isn't enabled in config so the inline comment to disable it is unnecessary.
The functionality of the old "structcheck" linter is now included in "unused".
Various changes in this new major version, including a new config file format: - "gofmt" and "goimports" are now categorized as formatters (instead of linters) and are moved to their own section. - The functionality of "gosimple" has been bundled into "staticcheck". Only the "gosimple" behaviour is enabled (prefix "S1") and all other "staticcheck" behaviour is disabled. - "typecheck" is now always on and cannot be independently enabled/disabled. Some changes needed to be made in source: - blake256: Ignore govet false positive. It triggers on some func signatures which are similar to stdlib funcs but not identical.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good. I'm think I'm going to hold off on merging this though because the most recent version of gopls
breaks with the v2
linter installed unless you also jump through some extra hoops to rename the binary, modify the linter flags in the editor's settings, and add an additional run param to the .golangci.yml
.
I looked at the gopls
issues and there is ongoing work to fix those things (and most of them have been merged to master already), so the next released version of gopls
will likely work properly with it.
@@ -9,7 +9,7 @@ import ( | |||
"fmt" | |||
"net" | |||
"net/http" | |||
_ "net/http/pprof" // nolint:gosec | |||
_ "net/http/pprof" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also should note that I do run gosec
locally, but it is not enabled in the repo on purpose since it gives a lot of false positives.
I just tested and this no longer seems to trigger a lint warning in the most recent version, so I don't mind this being removed. I might end up bringing some back though if any new cases are introduced even though it isn't enabled for the repo.
As an update to this, I've been following the development and the current preview version of the go plugin works properly (with a few modifications to the config file to tell it to use v2), however it hasn't been released yet. I'll merge this once the new version releases. |
Various changes in this new major version, including a new config file format:
gofmt
andgoimports
are now categorized as formatters (instead of linters) and are moved to their own section.gosimple
has been bundled intostaticcheck
. Only thegosimple
behaviour is enabled (prefix "S1") and all otherstaticcheck
behaviour is disabled.typecheck
is now always on and cannot be independently enabled/disabled.Also includes minor changes to Go source which are explained in commit comments.