-
Notifications
You must be signed in to change notification settings - Fork 431
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-lint #3242
upgrade golangci-lint #3242
Conversation
Hi @mweibel. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/ok-to-test |
/test pull-cluster-api-provider-azure-e2e |
/retest |
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
/assign @CecileRobertMichon @jackfrancis
LGTM label has been added. Git tree hash: 20779c14c7c925faabbf7298acf70b666ccbfc3e
|
/lgtm |
/retest |
Required |
hmm is |
azure/regional_baseuri.go
Outdated
@@ -24,7 +24,7 @@ import ( | |||
"github.com/pkg/errors" | |||
) | |||
|
|||
type aliasAuth = Authorizer | |||
type aliasAuth = Authorizer //nolint:unused // This is a false positive since aliasAuth is used right below. |
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 am a little confused, Why can't we use the below here?
type aliasAuth = Authorizer //nolint:unused // This is a false positive since aliasAuth is used right below. | |
type aliasAuth Authorizer |
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.
The relevant check reports this as unused even though it’s used (false positive). I briefly searched for issues related to it in the staticcheck repo and found a few with the mention that they‘ll work on 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.
Sorry, I did not frame the question right. I was wondering why is type aliasAuth = Authorizer
and not type aliasAuth Authorizer
. Looks like it doesn't really matter since aliasAuth
also turns out to be an interface type in both the scenarios.
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.
that's a good question. I tried adjusting the code according to your suggestion and lint doesn't complain anymore (of course also removed the nolint comment) and tests seem to pass too.
I wonder what the original intention was of adding that type alias though? The difference is explained quite well on this page but I wonder why it's needed at anyway? Why not just work with Authorizer
itself?
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.
should we try just removing it then? possibly it was needed at some point when it was added and that reason no longer exists.
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 tried to remove it and that led me to a way too long investigation why it doesn't work.
Summary: the type alias is needed because type Authorizer
also has a method named Authorizer()
(same name) and the compiler & linter gets confused when type baseURIAdapter
wants to embed the interface Authorizer
more or less minimum reproducing code: https://go.dev/play/p/nwjcUf9x4DI
how it would work without type alias (rename Authorizer method to Authorizor e.g.): https://go.dev/play/p/A5kCr0FrBPE
I think we can just settle to keep a type alias though. I'll use the other form @nawazkh proposed even though it has a slightly different semantic meaning.
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.
code is updated & commented. PTAL @CecileRobertMichon @nawazkh
/retest |
Failed with the kube-proxy image pull error again, that should be fixed now... /retest |
a3855f1
to
5a0598e
Compare
FYI @mboersma @CecileRobertMichon tests passed here but LGTM has been removed since I rebased on top of latest main. |
5a0598e
to
ff05045
Compare
/retest |
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
/retest
thanks for the investigation @mweibel!
LGTM label has been added. Git tree hash: d51526f441d985d441b7284fba9f1221c3db6d9d
|
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
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: CecileRobertMichon, mboersma 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 |
ran into #3227 again... /retest |
going to cherry-pick this because kpromo new version runs into the tools issue... if the bot lets me /cherry-pick release-1.8 release-1.7 |
@CecileRobertMichon: cannot checkout In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
ok bot /cherry-pick release-1.8 |
@CecileRobertMichon: new pull request created: #3321 In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/cherry-pick release-1.7 |
@CecileRobertMichon: #3242 failed to apply on top of branch "release-1.7":
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
I couldn't run golangci-lint locally due to memory/cpu spikes. In version 1.51 they improved that a lot (by also building with go 1.20). This upgrades the linter.
Special notes for your reviewer:
I had to rename the build tag to
capztools
because when running withtools
build tags there's an issue with another package:I'm not 100% certain why since my Go module know-how is still not that great unfortunately. I suspect that module also uses
tools
build tag for something and is imported by golangci-lint.Additionally, there are a couple of linting issues after upgrading:
I cleaned them up.
aliasAuth
is a false positive unfortunately.Release note: