-
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
Replace and remove deprecated linters #1848
Conversation
exp/controllers/helpers.go
Outdated
@@ -477,7 +477,7 @@ func MachinePoolToInfrastructureMapFunc(gvk schema.GroupVersionKind, log logr.Lo | |||
|
|||
// AzureClusterToAzureMachinePoolsFunc is a handler.MapFunc to be used to enqueue | |||
// requests for reconciliation of AzureMachinePools. | |||
func AzureClusterToAzureMachinePoolsFunc(ctx context.Context, kClient client.Client, log logr.Logger) handler.MapFunc { | |||
func AzureClusterToAzureMachinePoolsFunc(ctx context.Context, cli client.Client, log logr.Logger) handler.MapFunc { |
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.
curious was this a suggestion from the linter? Minor but I kind of like the additional information from having the k while reading the code.
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.
Yes, the revive
linter complained about this:
exp/controllers/helpers_test.go:569:5: var-naming: don't use leading k in Go names; var kClient should be client (revive)
I agree that kClient
is a more informative name than cli
. I didn't use client
because that's a package name already imported in those files (although we could import it with a different name).
I'm open to suggestions if there's a better var name to use here (that doesn't start with k
apparently).
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.
don't have a great one, apparently it is just variables starting with k and upper case after: https://github.com/mgechev/revive/blob/76b8c5732985b4332321ab368730fc16810726a1/rule/var-naming.go#L94-L101
so something like k8sCleint would work but not sure how I actually feel about it. cli is probably fine, was more interesting the k leading variable thing 😄
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.
looking at the rest of the codebase https://github.com/kubernetes-sigs/cluster-api-provider-azure/search?q=client.Client, we're using client
, c
, k8sClient
, kubeClient
in different places. We should probably standardize on one instead of introducing yet another name for 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.
makes sense to standardize, my vote would be for kubeClient
or k8sclient
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 like k8sClient
and kubeClient
. I'll try to hunt down the references and standardize them.
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 just went with local convention, as I should have done initially. So that's c
in helpers.go and fakeClient
in helpers_test.go.
We do have a hodgepodge of variable names for this, and so does CAPI. Seems like c
is the winner overall. I'm not sure it would be worth standardizing all of them; consistency is nice but maybe not that nice.
/retest |
/retest But that's an interesting and unrelated test failure: Error: resource name may not be empty• Failure [1488.583 seconds] Workload cluster creation /home/prow/go/src/sigs.k8s.io/cluster-api-provider-azure/test/e2e/azure_test.go:43 Creating a VMSS cluster /home/prow/go/src/sigs.k8s.io/cluster-api-provider-azure/test/e2e/azure_test.go:333 with a single control plane node and an AzureMachinePool with 2 Linux and 2 Windows worker nodes [It] /home/prow/go/src/sigs.k8s.io/cluster-api-provider-azure/test/e2e/azure_test.go:334 Unexpected error: cc: @devigned |
That's a new one on me. |
6339139
to
e666293
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.
/lgtm
/assign @jsturtevant
/approve |
1 similar comment
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: CecileRobertMichon, jsturtevant 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 |
What type of PR is this?:
/kind cleanup
What this PR does / why we need it:
Removes the deprecated
interfacer
linter and replacesgolint
withrevive
in the golangci-lint configuration. This silences two warnings and moves CAPZ closer to CAPI's linting configuration.Which issue(s) this PR fixes:
N/A
Special notes for your reviewer:
TODOs:
Release note: