From 0900742813990a024c05284a507e95557ae2d961 Mon Sep 17 00:00:00 2001 From: Thibault Richard Date: Fri, 26 May 2023 09:46:32 +0200 Subject: [PATCH] lint: unused argument --- pkg/controller/apmserver/controller_test.go | 2 +- .../elasticsearch/controller_legacy_test.go | 2 +- .../elasticsearch/bootstrap/bootstrap_test.go | 2 +- pkg/controller/elasticsearch/client/v6.go | 6 +++--- pkg/controller/elasticsearch/client/v7.go | 2 +- pkg/controller/elasticsearch/client/v8.go | 2 +- pkg/controller/elasticsearch/license/apply_test.go | 12 ++++++------ .../elasticsearch/observer/manager_test.go | 2 +- .../version/zen1/minimum_masters_test.go | 2 +- pkg/controller/kibana/config_settings.go | 2 +- pkg/controller/kibana/controller_test.go | 4 ++-- pkg/dev/portforward/pod_forwarder_test.go | 2 +- pkg/utils/vault/secret_file_test.go | 2 +- test/e2e/test/elasticsearch/checks_reversal.go | 2 +- test/e2e/test/logstash/http_client.go | 2 +- 15 files changed, 23 insertions(+), 23 deletions(-) diff --git a/pkg/controller/apmserver/controller_test.go b/pkg/controller/apmserver/controller_test.go index 3de80cace9..e9bb1975af 100644 --- a/pkg/controller/apmserver/controller_test.go +++ b/pkg/controller/apmserver/controller_test.go @@ -486,7 +486,7 @@ func withESReference(apm apmv1.ApmServer, selector commonv1.ObjectSelector) *apm return obj } -func withAssociationConf(apm apmv1.ApmServer, conf commonv1.AssociationConf) *apmv1.ApmServer { +func withAssociationConf(apm apmv1.ApmServer, _ commonv1.AssociationConf) *apmv1.ApmServer { obj := apm.DeepCopy() association := apmv1.NewApmEsAssociation(obj) association.SetAssociationConf( diff --git a/pkg/controller/autoscaling/elasticsearch/controller_legacy_test.go b/pkg/controller/autoscaling/elasticsearch/controller_legacy_test.go index 39ef60c144..3414506940 100644 --- a/pkg/controller/autoscaling/elasticsearch/controller_legacy_test.go +++ b/pkg/controller/autoscaling/elasticsearch/controller_legacy_test.go @@ -393,6 +393,6 @@ func (f *fakeEsClient) CreateAutoscalingPolicy(_ context.Context, _ string, _ v1 func (f *fakeEsClient) GetAutoscalingCapacity(_ context.Context) (esclient.AutoscalingCapacityResult, error) { return f.autoscalingPolicies, nil } -func (f *fakeEsClient) UpdateMLNodesSettings(_ context.Context, maxLazyMLNodes int32, maxMemory string) error { +func (f *fakeEsClient) UpdateMLNodesSettings(_ context.Context, _ int32, _ string) error { return nil } diff --git a/pkg/controller/elasticsearch/bootstrap/bootstrap_test.go b/pkg/controller/elasticsearch/bootstrap/bootstrap_test.go index fe0ba0f40e..62452c1415 100644 --- a/pkg/controller/elasticsearch/bootstrap/bootstrap_test.go +++ b/pkg/controller/elasticsearch/bootstrap/bootstrap_test.go @@ -40,7 +40,7 @@ type fakeESClient struct { err error } -func (f *fakeESClient) GetClusterInfo(ctx context.Context) (esclient.Info, error) { +func (f *fakeESClient) GetClusterInfo(_ context.Context) (esclient.Info, error) { return esclient.Info{ClusterUUID: f.uuid}, f.err } diff --git a/pkg/controller/elasticsearch/client/v6.go b/pkg/controller/elasticsearch/client/v6.go index 10dcfa8f45..f11b2bc891 100644 --- a/pkg/controller/elasticsearch/client/v6.go +++ b/pkg/controller/elasticsearch/client/v6.go @@ -156,11 +156,11 @@ func (c *clientV6) StartBasic(ctx context.Context) (StartBasicResponse, error) { return response, err } -func (c *clientV6) AddVotingConfigExclusions(ctx context.Context, nodeNames []string) error { +func (c *clientV6) AddVotingConfigExclusions(_ context.Context, _ []string) error { return errNotSupportedInEs6x } -func (c *clientV6) DeleteVotingConfigExclusions(ctx context.Context, waitForRemoval bool) error { +func (c *clientV6) DeleteVotingConfigExclusions(_ context.Context, waitForRemoval bool) error { return errNotSupportedInEs6x } @@ -211,7 +211,7 @@ func (c *clientV6) ClusterBootstrappedForZen2(ctx context.Context) (bool, error) return false, errors.New("no master found in ClusterBootstrappedForZen2") } -func (c *clientV6) GetClusterState(ctx context.Context) (ClusterState, error) { +func (c *clientV6) GetClusterState(_ context.Context) (ClusterState, error) { return ClusterState{}, errors.New("cluster state is not supported in Elasticsearch 6.x") } diff --git a/pkg/controller/elasticsearch/client/v7.go b/pkg/controller/elasticsearch/client/v7.go index 202d61188a..167678f2f3 100644 --- a/pkg/controller/elasticsearch/client/v7.go +++ b/pkg/controller/elasticsearch/client/v7.go @@ -92,7 +92,7 @@ func (c *clientV7) DeleteVotingConfigExclusions(ctx context.Context, waitForRemo return nil } -func (c *clientV7) GetClusterState(ctx context.Context) (ClusterState, error) { +func (c *clientV7) GetClusterState(_ context.Context) (ClusterState, error) { return ClusterState{}, errors.New("cluster state is not supported in Elasticsearch 7.x") } diff --git a/pkg/controller/elasticsearch/client/v8.go b/pkg/controller/elasticsearch/client/v8.go index 5f96caff0a..5f13e48353 100644 --- a/pkg/controller/elasticsearch/client/v8.go +++ b/pkg/controller/elasticsearch/client/v8.go @@ -25,7 +25,7 @@ func (c *clientV8) AddVotingConfigExclusions(ctx context.Context, nodeNames []st return nil } -func (c *clientV8) SyncedFlush(ctx context.Context) error { +func (c *clientV8) SyncedFlush(_ context.Context) error { return errors.New("synced flush is not supported in Elasticsearch 8.x") } diff --git a/pkg/controller/elasticsearch/license/apply_test.go b/pkg/controller/elasticsearch/license/apply_test.go index 70936eb3d1..b0ea54b0a6 100644 --- a/pkg/controller/elasticsearch/license/apply_test.go +++ b/pkg/controller/elasticsearch/license/apply_test.go @@ -314,7 +314,7 @@ type fakeInvalidLicenseUpdater struct { statusCodeOnGetLicense int } -func (f *fakeInvalidLicenseUpdater) GetLicense(ctx context.Context) (esclient.License, error) { +func (f *fakeInvalidLicenseUpdater) GetLicense(_ context.Context) (esclient.License, error) { if f.statusCodeOnGetLicense == 200 { return f.license, nil } @@ -327,18 +327,18 @@ type fakeLicenseUpdater struct { updateLicenseCalled bool } -func (f *fakeLicenseUpdater) StartTrial(ctx context.Context) (esclient.StartTrialResponse, error) { +func (f *fakeLicenseUpdater) StartTrial(_ context.Context) (esclient.StartTrialResponse, error) { return esclient.StartTrialResponse{ Acknowledged: true, TrialWasStarted: true, }, nil } -func (f *fakeLicenseUpdater) GetLicense(ctx context.Context) (esclient.License, error) { +func (f *fakeLicenseUpdater) GetLicense(_ context.Context) (esclient.License, error) { return f.license, nil } -func (f *fakeLicenseUpdater) UpdateLicense(ctx context.Context, licenses esclient.LicenseUpdateRequest) (esclient.LicenseUpdateResponse, error) { +func (f *fakeLicenseUpdater) UpdateLicense(_ context.Context, _ esclient.LicenseUpdateRequest) (esclient.LicenseUpdateResponse, error) { f.updateLicenseCalled = true return esclient.LicenseUpdateResponse{ Acknowledged: true, @@ -346,7 +346,7 @@ func (f *fakeLicenseUpdater) UpdateLicense(ctx context.Context, licenses esclien }, nil } -func (f *fakeLicenseUpdater) StartBasic(ctx context.Context) (esclient.StartBasicResponse, error) { +func (f *fakeLicenseUpdater) StartBasic(_ context.Context) (esclient.StartBasicResponse, error) { f.startBasicCalled = true return esclient.StartBasicResponse{}, nil } @@ -358,7 +358,7 @@ type fakeClient struct { errors map[client.ObjectKey]error } -func (f *fakeClient) Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error { +func (f *fakeClient) Get(_ context.Context, key client.ObjectKey, obj client.Object, _ ...client.GetOption) error { if err := f.errors[key]; err != nil { return err } diff --git a/pkg/controller/elasticsearch/observer/manager_test.go b/pkg/controller/elasticsearch/observer/manager_test.go index 32a9e65be9..04973bf743 100644 --- a/pkg/controller/elasticsearch/observer/manager_test.go +++ b/pkg/controller/elasticsearch/observer/manager_test.go @@ -244,7 +244,7 @@ func TestManager_StopObserving(t *testing.T) { } } -func TestManager_AddObservationListener(t *testing.T) { +func TestManager_AddObservationListener(_ *testing.T) { m := NewManager(1*time.Second, nil) ctx := context.Background() diff --git a/pkg/controller/elasticsearch/version/zen1/minimum_masters_test.go b/pkg/controller/elasticsearch/version/zen1/minimum_masters_test.go index a39f3aab83..e88f1f2600 100644 --- a/pkg/controller/elasticsearch/version/zen1/minimum_masters_test.go +++ b/pkg/controller/elasticsearch/version/zen1/minimum_masters_test.go @@ -96,7 +96,7 @@ type fakeESClient struct { client.Client } -func (f *fakeESClient) SetMinimumMasterNodes(ctx context.Context, count int) error { +func (f *fakeESClient) SetMinimumMasterNodes(_ context.Context, count int) error { f.called = true f.calledWith = count return nil diff --git a/pkg/controller/kibana/config_settings.go b/pkg/controller/kibana/config_settings.go index 87ed7dfb8e..726b6f2a8b 100644 --- a/pkg/controller/kibana/config_settings.go +++ b/pkg/controller/kibana/config_settings.go @@ -179,7 +179,7 @@ func filterConfigSettings(kb kbv1.Kibana, cfg *settings.CanonicalConfig) error { } // VersionDefaults generates any version specific settings that should exist by default. -func VersionDefaults(kb *kbv1.Kibana, v version.Version) *settings.CanonicalConfig { +func VersionDefaults(_ *kbv1.Kibana, v version.Version) *settings.CanonicalConfig { if v.GTE(version.From(7, 6, 0)) { // setting exists only as of 7.6.0 return settings.MustCanonicalConfig(map[string]interface{}{XpackLicenseManagementUIEnabled: false}) diff --git a/pkg/controller/kibana/controller_test.go b/pkg/controller/kibana/controller_test.go index 2df4510c10..f4d36c4996 100644 --- a/pkg/controller/kibana/controller_test.go +++ b/pkg/controller/kibana/controller_test.go @@ -425,11 +425,11 @@ func newK8sFailingStatusUpdateClient(initObjs ...client.Object) *k8sFailingStatu } } -func (k *k8sFailingStatusUpdateClient) Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error { +func (k *k8sFailingStatusUpdateClient) Get(ctx context.Context, key client.ObjectKey, obj client.Object, _ ...client.GetOption) error { return k.client.Get(ctx, key, obj) } -func (k *k8sFailingStatusUpdateClient) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error { +func (k *k8sFailingStatusUpdateClient) Update(_ context.Context, _ client.Object, _ ...client.UpdateOption) error { return errors.New("internal error") } diff --git a/pkg/dev/portforward/pod_forwarder_test.go b/pkg/dev/portforward/pod_forwarder_test.go index 0b82290cda..ae132fd56e 100644 --- a/pkg/dev/portforward/pod_forwarder_test.go +++ b/pkg/dev/portforward/pod_forwarder_test.go @@ -21,7 +21,7 @@ type capturingDialer struct { addresses []string } -func (d *capturingDialer) DialContext(ctx context.Context, network, address string) (net.Conn, error) { +func (d *capturingDialer) DialContext(_ context.Context, _, address string) (net.Conn, error) { d.addresses = append(d.addresses, address) return nil, nil } diff --git a/pkg/utils/vault/secret_file_test.go b/pkg/utils/vault/secret_file_test.go index 1ddb223048..cd7f56e81b 100644 --- a/pkg/utils/vault/secret_file_test.go +++ b/pkg/utils/vault/secret_file_test.go @@ -193,7 +193,7 @@ func newMockClient(t *testing.T, data ...string) Client { } } -func (c *mockClient) Read(path string) (*api.Secret, error) { +func (c *mockClient) Read(_ string) (*api.Secret, error) { c.readCount++ return &api.Secret{Data: c.data}, nil } diff --git a/test/e2e/test/elasticsearch/checks_reversal.go b/test/e2e/test/elasticsearch/checks_reversal.go index 28c0e2a93c..631310edeb 100644 --- a/test/e2e/test/elasticsearch/checks_reversal.go +++ b/test/e2e/test/elasticsearch/checks_reversal.go @@ -82,7 +82,7 @@ func (s *MutationReversalTestContext) PostMutationSteps(k *test.K8sClient) test. } } -func (s *MutationReversalTestContext) VerificationSteps(k *test.K8sClient) test.StepList { +func (s *MutationReversalTestContext) VerificationSteps(_ *test.K8sClient) test.StepList { //nolint:thelper return test.StepList{ { diff --git a/test/e2e/test/logstash/http_client.go b/test/e2e/test/logstash/http_client.go index c5b271c242..f57802f1c9 100644 --- a/test/e2e/test/logstash/http_client.go +++ b/test/e2e/test/logstash/http_client.go @@ -19,7 +19,7 @@ import ( ) // TODO refactor identical to Kibana client -func NewLogstashClient(logstash v1alpha1.Logstash, k *test.K8sClient) (*http.Client, error) { +func NewLogstashClient(logstash v1alpha1.Logstash, _ *test.K8sClient) (*http.Client, error) { var caCerts []*x509.Certificate // TODO: Integrate with TLS on metrics API // if ems.Spec.HTTP.TLS.Enabled() {