Skip to content

Commit d1ec32a

Browse files
authored
Merge pull request #7450 from oscr/enable-revive-unused
✨ Enable revive linter unused-parameter and fix all findings
2 parents ea4879a + 1d514cb commit d1ec32a

File tree

42 files changed

+102
-102
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+102
-102
lines changed

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ linters-settings:
176176
- name: errorf
177177
- name: empty-block
178178
- name: superfluous-else
179-
#- name: unused-parameter # TODO This is a recommended rule with many findings which may require it's own pr.
179+
- name: unused-parameter
180180
- name: unreachable-code
181181
- name: redefines-builtin-id
182182
#

api/v1alpha3/conversion.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,13 +277,13 @@ func (dst *MachineHealthCheckList) ConvertFrom(srcRaw conversion.Hub) error {
277277
return Convert_v1beta1_MachineHealthCheckList_To_v1alpha3_MachineHealthCheckList(src, dst, nil)
278278
}
279279

280-
func Convert_v1beta1_MachineSetStatus_To_v1alpha3_MachineSetStatus(in *clusterv1.MachineSetStatus, out *MachineSetStatus, s apiconversion.Scope) error {
280+
func Convert_v1beta1_MachineSetStatus_To_v1alpha3_MachineSetStatus(in *clusterv1.MachineSetStatus, out *MachineSetStatus, _ apiconversion.Scope) error {
281281
// Status.Conditions was introduced in v1alpha4, thus requiring a custom conversion function; the values is going to be preserved in an annotation thus allowing roundtrip without loosing informations
282282
return autoConvert_v1beta1_MachineSetStatus_To_v1alpha3_MachineSetStatus(in, out, nil)
283283
}
284284

285285
func Convert_v1beta1_ClusterSpec_To_v1alpha3_ClusterSpec(in *clusterv1.ClusterSpec, out *ClusterSpec, s apiconversion.Scope) error {
286-
// NOTE: custom conversion func is required because spec.Topology does not exists in v1alpha3
286+
// NOTE: custom conversion func is required because spec.Topology does not exist in v1alpha3
287287
return autoConvert_v1beta1_ClusterSpec_To_v1alpha3_ClusterSpec(in, out, s)
288288
}
289289

bootstrap/kubeadm/api/v1alpha3/conversion_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,12 @@ func clusterConfigurationFuzzer(obj *upstreamv1beta1.ClusterConfiguration, c fuz
8282
obj.UseHyperKubeImage = false
8383
}
8484

85-
func kubeadmBootstrapTokenStringFuzzerV1UpstreamBeta1(in *upstreamv1beta1.BootstrapTokenString, c fuzz.Continue) {
85+
func kubeadmBootstrapTokenStringFuzzerV1UpstreamBeta1(in *upstreamv1beta1.BootstrapTokenString, _ fuzz.Continue) {
8686
in.ID = "abcdef"
8787
in.Secret = "abcdef0123456789"
8888
}
8989

90-
func kubeadmBootstrapTokenStringFuzzerV1Beta1(in *bootstrapv1.BootstrapTokenString, c fuzz.Continue) {
90+
func kubeadmBootstrapTokenStringFuzzerV1Beta1(in *bootstrapv1.BootstrapTokenString, _ fuzz.Continue) {
9191
in.ID = "abcdef"
9292
in.Secret = "abcdef0123456789"
9393
}

bootstrap/kubeadm/api/v1alpha4/conversion_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,17 @@ func clusterConfigurationFuzzer(obj *upstreamv1beta1.ClusterConfiguration, c fuz
8080
obj.UseHyperKubeImage = false
8181
}
8282

83-
func kubeadmBootstrapTokenStringFuzzerV1UpstreamBeta1(in *upstreamv1beta1.BootstrapTokenString, c fuzz.Continue) {
83+
func kubeadmBootstrapTokenStringFuzzerV1UpstreamBeta1(in *upstreamv1beta1.BootstrapTokenString, _ fuzz.Continue) {
8484
in.ID = fakeID
8585
in.Secret = fakeSecret
8686
}
8787

88-
func kubeadmBootstrapTokenStringFuzzerV1Beta1(in *bootstrapv1.BootstrapTokenString, c fuzz.Continue) {
88+
func kubeadmBootstrapTokenStringFuzzerV1Beta1(in *bootstrapv1.BootstrapTokenString, _ fuzz.Continue) {
8989
in.ID = fakeID
9090
in.Secret = fakeSecret
9191
}
9292

93-
func kubeadmBootstrapTokenStringFuzzerV1Alpha4(in *BootstrapTokenString, c fuzz.Continue) {
93+
func kubeadmBootstrapTokenStringFuzzerV1Alpha4(in *BootstrapTokenString, _ fuzz.Continue) {
9494
in.ID = fakeID
9595
in.Secret = fakeSecret
9696
}

bootstrap/kubeadm/api/v1beta1/kubeadmconfig_webhook.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func (c *KubeadmConfig) ValidateCreate() error {
7070
}
7171

7272
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type.
73-
func (c *KubeadmConfig) ValidateUpdate(old runtime.Object) error {
73+
func (c *KubeadmConfig) ValidateUpdate(_ runtime.Object) error {
7474
return c.Spec.validate(c.Name)
7575
}
7676

bootstrap/kubeadm/api/v1beta1/kubeadmconfigtemplate_webhook.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func (r *KubeadmConfigTemplate) ValidateCreate() error {
4949
}
5050

5151
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type.
52-
func (r *KubeadmConfigTemplate) ValidateUpdate(old runtime.Object) error {
52+
func (r *KubeadmConfigTemplate) ValidateUpdate(_ runtime.Object) error {
5353
return r.Spec.validate(r.Name)
5454
}
5555

cmd/clusterctl/client/client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import (
3838
)
3939

4040
// TestNewFakeClient is a fake test to document fakeClient usage.
41-
func TestNewFakeClient(t *testing.T) {
41+
func TestNewFakeClient(_ *testing.T) {
4242
// create a fake config with a provider named P1 and a variable named var
4343
repository1Config := config.NewProvider("p1", "url", clusterctlv1.CoreProviderType)
4444

cmd/clusterctl/client/cluster/internal/dryrun/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ func (c *Client) Delete(ctx context.Context, obj client.Object, opts ...client.D
248248

249249
// Update updates the given obj in the internal object tracker.
250250
// NOTE: Topology reconciler does not use update, so we are skipping implementation for now.
251-
func (c *Client) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error {
251+
func (c *Client) Update(_ context.Context, _ client.Object, _ ...client.UpdateOption) error {
252252
panic("Update method is not supported by the dryrun client")
253253
}
254254

@@ -284,7 +284,7 @@ func (c *Client) Patch(ctx context.Context, obj client.Object, patch client.Patc
284284

285285
// DeleteAllOf deletes all objects of the given type matching the given options.
286286
// NOTE: Topology reconciler does not use DeleteAllOf, so we are skipping implementation for now.
287-
func (c *Client) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error {
287+
func (c *Client) DeleteAllOf(_ context.Context, _ client.Object, _ ...client.DeleteAllOfOption) error {
288288
panic("DeleteAllOf method is not supported by the dryrun client")
289289
}
290290

cmd/clusterctl/client/cluster/inventory_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131
"sigs.k8s.io/cluster-api/cmd/clusterctl/internal/test"
3232
)
3333

34-
func fakePollImmediateWaiter(interval, timeout time.Duration, condition wait.ConditionFunc) error {
34+
func fakePollImmediateWaiter(_, _ time.Duration, _ wait.ConditionFunc) error {
3535
return nil
3636
}
3737

cmd/clusterctl/client/cluster/topology.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -631,9 +631,9 @@ func filterObjects(objs []*unstructured.Unstructured, gvks ...schema.GroupVersio
631631

632632
type noOpRecorder struct{}
633633

634-
func (nr *noOpRecorder) Event(_ runtime.Object, _, _, _ string) {}
635-
func (nr *noOpRecorder) Eventf(_ runtime.Object, _, _, _ string, args ...interface{}) {}
636-
func (nr *noOpRecorder) AnnotatedEventf(_ runtime.Object, _ map[string]string, _, _, _ string, args ...interface{}) {
634+
func (nr *noOpRecorder) Event(_ runtime.Object, _, _, _ string) {}
635+
func (nr *noOpRecorder) Eventf(_ runtime.Object, _, _, _ string, _ ...interface{}) {}
636+
func (nr *noOpRecorder) AnnotatedEventf(_ runtime.Object, _ map[string]string, _, _, _ string, _ ...interface{}) {
637637
}
638638

639639
func objToRef(o *unstructured.Unstructured) *corev1.ObjectReference {

0 commit comments

Comments
 (0)