-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
✨ Upgrade golangci from 1.54 to 1.57 #3846
✨ Upgrade golangci from 1.54 to 1.57 #3846
Conversation
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: camilamacedo86, Kavinjsir The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@@ -20,7 +20,9 @@ import ( | |||
"fmt" | |||
"testing" | |||
|
|||
// nolint:revive |
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.
Rather than having all of these nolint:revive
lines, I think we are safe to assume dot imports will be used for intentional reasons. I think it would be cleaner to just remove the dot-imports
rule from line 28 in .golangci.yml
.
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.
Agreed. One way maybe:
[rule.dot-imports]
arguments = [{ allowedPackages = ["github.com/onsi/ginkgo/v2","github.com/onsi/gomega"] }]
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.
We should not use dot imports
Just the case of ginkgo and gomega which are an exception.
So, we still want the check
If a config like
[rule.dot-imports]
arguments = [{ allowedPackages = ["github.com/onsi/ginkgo/v2","github.com/onsi/gomega"] }]
Works then, It is totally fine.
We can use it
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.
Hi @stmcginnis
Rather than having all of these nolint:revive lines, I think we are safe to assume dot imports will be used for intentional reasons. I think it would be cleaner to just remove the dot-imports rule from line 28 in .golangci.yml.
We should still not using alias with .
. However, yes we have one exception which we have been using // nolint to ignore those which are only. Then, if we do not check it probably we will end up using it without a good reason too.
// nolint:revive
. "github.com/onsi/ginkgo/v2"
// nolint:revive
. "github.com/onsi/gomega"
The lint fix of this PR just ensure that we have those applied equally in all places
Note that seems that some files we were not checking and because of this they were without the //nolint
check.
However, to ignore this case I totally agree that would be nice if we could find a way to configure it as @Kavinjsir suggested. He also open an issue: #3847 (which I understand would have this goal)
Therefore, IMO it seems fine we try to replace those in a follow up with the suggestion if we be able to check that can works. +1 💯
The other rule that we need to fix here is for we use _
instead of args name when those are not used which is also a valid rule see: (i.e. https://github.com/kubernetes-sigs/kubebuilder/pull/3846/files#diff-e5f2449f45b05bf525a27e22a412864f1d479ac4548d5ffe3c90da55fdfee3f6R34-R39)
In this way, since:
- @Kavinjsir /lgtm this one
- It only do the bump and ensure that we are ignoring equally in all place the
ginkgo
andgomega
exception regards the dots imports - Do the fix of the
_
for args not used in the missing places - And we have a issue to see if we can improve in a follow up
- By last it is too silly small/nit one
I think it is safe we get this one merged and I am going forward with this one.
I hope you both has no objections.
But please feel free to contribute within for we improve this in a follow up as you see that it would fit.
Thank you a lot for your collaboration @Kavinjsir and @stmcginnis 🎉
a) Ensure that in all places we are ignoring the exception equally
b) Ensure that we use
_
for args not explicit called in the funcs. Example