-
Notifications
You must be signed in to change notification settings - Fork 557
Bump golangci-lint to v2 and fix new lint issues #3385
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: main
Are you sure you want to change the base?
Conversation
a99c5c5
to
417f785
Compare
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.
thanks for the PR, see my comments
don't mind me, just asking: are we sure those linters are worth the effort? |
the ones that modify error messages? partly... |
417f785
to
b685092
Compare
daf94e2
to
159141c
Compare
159141c
to
02c2636
Compare
02c2636
to
211f8d0
Compare
Good thing we haven't backported #3351 to v2 yet, looks like it's causing issue with many endpoints. |
Tell me about it 😅 I'm working on this now #3420 I also think we might want to reduce the size of our test matrix wrt versions (maybe just test |
Done by bumping the version in the Makefile and running the 'golangci-lint migrate' command via podman as we do in the Makefile. podman run -t --rm -v $PWD:/app -w /app \ golangci/golangci-lint:v2.1.6 \ golangci-lint migrate This yields a number of news error from staticcheck, listed below, which we temporarily ignore pending a fix. S1038: should use fmt.Fprintf instead of fmt.Fprint(fmt.Sprintf(...)) ST1005: error strings should not be capitalized ST1005: error strings should not end with punctuation or newlines ST1017: don't use Yoda conditions ST1019: package ".*" is being imported more than once ST1019(related information): other import of ".*" ST1023: should omit type .* from declaration; it will be inferred from the right-hand side QF1011: could omit type .* from declaration; it will be inferred from the right-hand side QF1001: could apply De Morgan's law QF1003: could use tagged switch on .* QF1004: could use strings.ReplaceAll instead QF1008: could remove embedded field ".*" from selector Signed-off-by: Stephen Finucane <[email protected]>
Signed-off-by: Stephen Finucane <[email protected]>
Signed-off-by: Stephen Finucane <[email protected]>
Signed-off-by: Stephen Finucane <[email protected]>
Signed-off-by: Stephen Finucane <[email protected]>
Signed-off-by: Stephen Finucane <[email protected]>
This looks complicated, but it's just a whole lot of sed invocations. Signed-off-by: Stephen Finucane <[email protected]>
Signed-off-by: Stephen Finucane <[email protected]>
More sed, along with some manual fixups. sed -i 's/fmt.Errorf("\([A-Z]\)/fmt.Errorf("\L\1/' \ $(ag 'fmt.Errorf\("[A-Z]' -l) sed -i 's/fmt.Errorf("\(.*\)\.")/fmt.Errorf("\1")/' \ $(ag 'fmt.Errorf\(' -l) sed -i 's/errors.New("\([A-Z]\)/errors.New("\L\1/' \ $(ag 'errors.New\("[A-Z]' -l) sed -i 's/errors.New("\(.*\)\.")/errors.New("\1")/' \ $(ag 'errors.New\(' -l) (yes, that could have a one-liner but $complexity) Signed-off-by: Stephen Finucane <[email protected]>
I'm not sure why this was disabled, but undisable it. Signed-off-by: Stephen Finucane <[email protected]>
211f8d0
to
9d00a1b
Compare
This is a large but relatively trivial PR that, per $subject, bumps our version of golangci-lint to the latest version and addresses any conflicts introduced. The only user-facing change is that some errors messages have changed (lowercase first characters and stripped full stops).