Bump golangci-lint to v2 and fix new lint issues#3385
Merged
mandre merged 10 commits intogophercloud:mainfrom Jun 20, 2025
Merged
Bump golangci-lint to v2 and fix new lint issues#3385mandre merged 10 commits intogophercloud:mainfrom
mandre merged 10 commits intogophercloud:mainfrom
Conversation
a99c5c5 to
417f785
Compare
kayrus
reviewed
May 20, 2025
Contributor
kayrus
left a comment
There was a problem hiding this comment.
thanks for the PR, see my comments
Member
|
don't mind me, just asking: are we sure those linters are worth the effort? |
Contributor
|
the ones that modify error messages? partly... |
417f785 to
b685092
Compare
mandre
previously approved these changes
May 22, 2025
daf94e2 to
159141c
Compare
159141c to
02c2636
Compare
02c2636 to
211f8d0
Compare
Contributor
|
Good thing we haven't backported #3351 to v2 yet, looks like it's causing issue with many endpoints. |
Contributor
Author
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 <stephenfin@redhat.com>
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This looks complicated, but it's just a whole lot of sed invocations. Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
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 <stephenfin@redhat.com>
I'm not sure why this was disabled, but undisable it. Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
211f8d0 to
9d00a1b
Compare
mandre
approved these changes
Jun 20, 2025
|
Failed to backport PR to |
Merged
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).