From 1cf7c3a6e31d699c78d0034810a5db21a871e249 Mon Sep 17 00:00:00 2001 From: Gustavo Fernandes de Carvalho Date: Fri, 12 May 2023 05:11:33 -0300 Subject: [PATCH] :broom: Bumping GolangciLint version and fixing lint issues (#2304) Signed-off-by: Gustavo Carvalho --- .github/workflows/ci.yml | 2 +- .../v1beta1/externalsecret_validator.go | 6 ++-- .../v1beta1/provider_schema_test.go | 16 +++++----- .../v1beta1/secretstore_validator.go | 6 ++-- pkg/controllers/crds/crds_controller.go | 10 ++----- .../externalsecret_controller.go | 10 ++----- .../externalsecret_controller_template.go | 2 +- .../secretstore/client_manager_test.go | 14 ++++----- pkg/generator/acr/acr.go | 2 +- pkg/generator/acr/acr_test.go | 2 +- pkg/generator/fake/fake.go | 2 +- pkg/generator/password/password.go | 2 +- pkg/provider/akeyless/akeyless.go | 6 ++-- pkg/provider/akeyless/fake/fake.go | 6 ++-- pkg/provider/alibaba/fake/fake.go | 2 +- pkg/provider/alibaba/kms.go | 8 ++--- pkg/provider/aws/auth/fake/assumeroler.go | 2 +- .../aws/parameterstore/parameterstore.go | 2 +- pkg/provider/aws/secretsmanager/fake/fake.go | 2 +- .../aws/secretsmanager/secretsmanager.go | 2 +- pkg/provider/azure/keyvault/fake/fake.go | 28 ++++++++--------- pkg/provider/azure/keyvault/keyvault.go | 18 +++++------ pkg/provider/doppler/client.go | 4 +-- pkg/provider/doppler/fake/fake.go | 2 +- pkg/provider/fake/fake.go | 14 ++++----- pkg/provider/gcp/secretmanager/client.go | 2 +- pkg/provider/gcp/secretmanager/fake/fake.go | 24 +++++++-------- .../secretmanager/workload_identity_test.go | 8 ++--- pkg/provider/gitlab/fake/fake.go | 10 +++---- pkg/provider/gitlab/gitlab.go | 10 +++---- pkg/provider/ibm/provider.go | 12 ++++---- pkg/provider/keepersecurity/client.go | 12 ++++---- pkg/provider/kubernetes/client.go | 6 ++-- pkg/provider/kubernetes/client_test.go | 4 +-- pkg/provider/kubernetes/provider.go | 2 +- pkg/provider/kubernetes/validate_test.go | 2 +- pkg/provider/onepassword/fake/fake.go | 30 +++++++++---------- pkg/provider/onepassword/onepassword.go | 12 ++++---- pkg/provider/oracle/fake/fake.go | 2 +- pkg/provider/oracle/oracle.go | 8 ++--- pkg/provider/senhasegura/dsm/dsm.go | 12 ++++---- pkg/provider/testing/fake/fake.go | 8 ++--- pkg/provider/util/fake/token_fetcher.go | 10 +++---- pkg/provider/vault/fake/vault.go | 2 +- pkg/provider/vault/vault_test.go | 2 +- pkg/provider/webhook/webhook.go | 12 ++++---- .../certificatemanager/client/fakeclient.go | 2 +- .../certificatemanager/client/grpcclient.go | 2 +- pkg/provider/yandex/common/sdk.go | 2 +- pkg/provider/yandex/common/secretsclient.go | 8 ++--- .../yandex/lockbox/client/fakeclient.go | 2 +- pkg/template/v1/template.go | 2 +- 52 files changed, 183 insertions(+), 195 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 16637f9a555..0d0be8310bf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ on: env: # Common versions - GOLANGCI_VERSION: 'v1.49.0' + GOLANGCI_VERSION: 'v1.52.2' KUBERNETES_VERSION: '1.24.x' # Sonar diff --git a/apis/externalsecrets/v1beta1/externalsecret_validator.go b/apis/externalsecrets/v1beta1/externalsecret_validator.go index 540ec52e5d5..da74a2860a9 100644 --- a/apis/externalsecrets/v1beta1/externalsecret_validator.go +++ b/apis/externalsecrets/v1beta1/externalsecret_validator.go @@ -22,15 +22,15 @@ import ( type ExternalSecretValidator struct{} -func (esv *ExternalSecretValidator) ValidateCreate(ctx context.Context, obj runtime.Object) error { +func (esv *ExternalSecretValidator) ValidateCreate(_ context.Context, obj runtime.Object) error { return validateExternalSecret(obj) } -func (esv *ExternalSecretValidator) ValidateUpdate(ctx context.Context, oldObj, newObj runtime.Object) error { +func (esv *ExternalSecretValidator) ValidateUpdate(_ context.Context, _, newObj runtime.Object) error { return validateExternalSecret(newObj) } -func (esv *ExternalSecretValidator) ValidateDelete(ctx context.Context, obj runtime.Object) error { +func (esv *ExternalSecretValidator) ValidateDelete(_ context.Context, _ runtime.Object) error { return nil } diff --git a/apis/externalsecrets/v1beta1/provider_schema_test.go b/apis/externalsecrets/v1beta1/provider_schema_test.go index 8bf12dc04fa..411264cfd45 100644 --- a/apis/externalsecrets/v1beta1/provider_schema_test.go +++ b/apis/externalsecrets/v1beta1/provider_schema_test.go @@ -30,37 +30,37 @@ func (p *PP) Capabilities() SecretStoreCapabilities { } // New constructs a SecretsManager Provider. -func (p *PP) NewClient(ctx context.Context, store GenericStore, kube client.Client, namespace string) (SecretsClient, error) { +func (p *PP) NewClient(_ context.Context, _ GenericStore, _ client.Client, _ string) (SecretsClient, error) { return p, nil } // PushSecret writes a single secret into a provider. -func (p *PP) PushSecret(ctx context.Context, value []byte, remoteRef PushRemoteRef) error { +func (p *PP) PushSecret(_ context.Context, _ []byte, _ PushRemoteRef) error { return nil } // DeleteSecret deletes a single secret from a provider. -func (p *PP) DeleteSecret(ctx context.Context, remoteRef PushRemoteRef) error { +func (p *PP) DeleteSecret(_ context.Context, _ PushRemoteRef) error { return nil } // GetSecret returns a single secret from the provider. -func (p *PP) GetSecret(ctx context.Context, ref ExternalSecretDataRemoteRef) ([]byte, error) { +func (p *PP) GetSecret(_ context.Context, _ ExternalSecretDataRemoteRef) ([]byte, error) { return []byte("NOOP"), nil } // GetSecretMap returns multiple k/v pairs from the provider. -func (p *PP) GetSecretMap(ctx context.Context, ref ExternalSecretDataRemoteRef) (map[string][]byte, error) { +func (p *PP) GetSecretMap(_ context.Context, _ ExternalSecretDataRemoteRef) (map[string][]byte, error) { return map[string][]byte{}, nil } // Empty GetAllSecrets. -func (p *PP) GetAllSecrets(ctx context.Context, ref ExternalSecretFind) (map[string][]byte, error) { +func (p *PP) GetAllSecrets(_ context.Context, _ ExternalSecretFind) (map[string][]byte, error) { // TO be implemented return map[string][]byte{}, nil } -func (p *PP) Close(ctx context.Context) error { +func (p *PP) Close(_ context.Context) error { return nil } @@ -68,7 +68,7 @@ func (p *PP) Validate() (ValidationResult, error) { return ValidationResultReady, nil } -func (p *PP) ValidateStore(store GenericStore) error { +func (p *PP) ValidateStore(_ GenericStore) error { return nil } diff --git a/apis/externalsecrets/v1beta1/secretstore_validator.go b/apis/externalsecrets/v1beta1/secretstore_validator.go index 94c477ac255..67021918b97 100644 --- a/apis/externalsecrets/v1beta1/secretstore_validator.go +++ b/apis/externalsecrets/v1beta1/secretstore_validator.go @@ -31,7 +31,7 @@ const ( type GenericStoreValidator struct{} // ValidateCreate implements webhook.Validator so a webhook will be registered for the type. -func (r *GenericStoreValidator) ValidateCreate(ctx context.Context, obj runtime.Object) error { +func (r *GenericStoreValidator) ValidateCreate(_ context.Context, obj runtime.Object) error { st, ok := obj.(GenericStore) if !ok { return fmt.Errorf(errInvalidStore) @@ -40,7 +40,7 @@ func (r *GenericStoreValidator) ValidateCreate(ctx context.Context, obj runtime. } // ValidateUpdate implements webhook.Validator so a webhook will be registered for the type. -func (r *GenericStoreValidator) ValidateUpdate(ctx context.Context, oldObj, newObj runtime.Object) error { +func (r *GenericStoreValidator) ValidateUpdate(_ context.Context, _, newObj runtime.Object) error { st, ok := newObj.(GenericStore) if !ok { return fmt.Errorf(errInvalidStore) @@ -49,7 +49,7 @@ func (r *GenericStoreValidator) ValidateUpdate(ctx context.Context, oldObj, newO } // ValidateDelete implements webhook.Validator so a webhook will be registered for the type. -func (r *GenericStoreValidator) ValidateDelete(ctx context.Context, obj runtime.Object) error { +func (r *GenericStoreValidator) ValidateDelete(_ context.Context, _ runtime.Object) error { return nil } diff --git a/pkg/controllers/crds/crds_controller.go b/pkg/controllers/crds/crds_controller.go index a09eb9f28fb..04bb835bbb1 100644 --- a/pkg/controllers/crds/crds_controller.go +++ b/pkg/controllers/crds/crds_controller.go @@ -200,10 +200,7 @@ func (r *Reconciler) updateCRD(ctx context.Context, req ctrl.Request) error { return err } } - if err := r.Update(ctx, &updatedResource); err != nil { - return err - } - return nil + return r.Update(ctx, &updatedResource) } func injectService(crd *apiext.CustomResourceDefinition, svc types.NamespacedName) error { @@ -344,10 +341,7 @@ func (r *Reconciler) refreshCerts(refreshCA bool, secret *corev1.Secret) error { if err != nil { return err } - if err := r.writeSecret(cert, key, caArtifacts, secret); err != nil { - return err - } - return nil + return r.writeSecret(cert, key, caArtifacts, secret) } func buildArtifactsFromSecret(secret *corev1.Secret) (*KeyPairArtifacts, error) { diff --git a/pkg/controllers/externalsecret/externalsecret_controller.go b/pkg/controllers/externalsecret/externalsecret_controller.go index 2a0ded3f920..8d6535196bf 100644 --- a/pkg/controllers/externalsecret/externalsecret_controller.go +++ b/pkg/controllers/externalsecret/externalsecret_controller.go @@ -331,10 +331,7 @@ func createOrUpdate(ctx context.Context, c client.Client, obj client.Object, f f return err } // Setting Field Owner even for CreationPolicy==Create - if err := c.Create(ctx, obj, client.FieldOwner(fqdn)); err != nil { - return err - } - return nil + return c.Create(ctx, obj, client.FieldOwner(fqdn)) } existing := obj.DeepCopyObject() @@ -346,10 +343,7 @@ func createOrUpdate(ctx context.Context, c client.Client, obj client.Object, f f return nil } - if err := c.Update(ctx, obj, client.FieldOwner(fqdn)); err != nil { - return err - } - return nil + return c.Update(ctx, obj, client.FieldOwner(fqdn)) } func patchSecret(ctx context.Context, c client.Client, scheme *runtime.Scheme, secret *v1.Secret, mutationFunc func() error, fieldOwner string) error { diff --git a/pkg/controllers/externalsecret/externalsecret_controller_template.go b/pkg/controllers/externalsecret/externalsecret_controller_template.go index e48c54ed897..aa7b5deae54 100644 --- a/pkg/controllers/externalsecret/externalsecret_controller_template.go +++ b/pkg/controllers/externalsecret/externalsecret_controller_template.go @@ -100,7 +100,7 @@ func (p *Parser) MergeSecret(ctx context.Context, namespace string, tpl esv1beta return nil } -func (p *Parser) MergeLiteral(ctx context.Context, tpl esv1beta1.TemplateFrom) error { +func (p *Parser) MergeLiteral(_ context.Context, tpl esv1beta1.TemplateFrom) error { if tpl.Literal == nil { return nil } diff --git a/pkg/controllers/secretstore/client_manager_test.go b/pkg/controllers/secretstore/client_manager_test.go index 1475522c3a3..a71945b4020 100644 --- a/pkg/controllers/secretstore/client_manager_test.go +++ b/pkg/controllers/secretstore/client_manager_test.go @@ -331,7 +331,7 @@ func (f *WrapProvider) Capabilities() esv1beta1.SecretStoreCapabilities { } // ValidateStore checks if the provided store is valid. -func (f *WrapProvider) ValidateStore(store esv1beta1.GenericStore) error { +func (f *WrapProvider) ValidateStore(_ esv1beta1.GenericStore) error { return nil } @@ -340,15 +340,15 @@ type MockFakeClient struct { closeCalled bool } -func (c *MockFakeClient) PushSecret(ctx context.Context, value []byte, remoteRef esv1beta1.PushRemoteRef) error { +func (c *MockFakeClient) PushSecret(_ context.Context, _ []byte, _ esv1beta1.PushRemoteRef) error { return nil } -func (c *MockFakeClient) DeleteSecret(ctx context.Context, remoteRef esv1beta1.PushRemoteRef) error { +func (c *MockFakeClient) DeleteSecret(_ context.Context, _ esv1beta1.PushRemoteRef) error { return nil } -func (c *MockFakeClient) GetSecret(ctx context.Context, ref esv1beta1.ExternalSecretDataRemoteRef) ([]byte, error) { +func (c *MockFakeClient) GetSecret(_ context.Context, _ esv1beta1.ExternalSecretDataRemoteRef) ([]byte, error) { return nil, nil } @@ -357,16 +357,16 @@ func (c *MockFakeClient) Validate() (esv1beta1.ValidationResult, error) { } // GetSecretMap returns multiple k/v pairs from the provider. -func (c *MockFakeClient) GetSecretMap(ctx context.Context, ref esv1beta1.ExternalSecretDataRemoteRef) (map[string][]byte, error) { +func (c *MockFakeClient) GetSecretMap(_ context.Context, _ esv1beta1.ExternalSecretDataRemoteRef) (map[string][]byte, error) { return nil, nil } // GetAllSecrets returns multiple k/v pairs from the provider. -func (c *MockFakeClient) GetAllSecrets(ctx context.Context, ref esv1beta1.ExternalSecretFind) (map[string][]byte, error) { +func (c *MockFakeClient) GetAllSecrets(_ context.Context, _ esv1beta1.ExternalSecretFind) (map[string][]byte, error) { return nil, nil } -func (c *MockFakeClient) Close(ctx context.Context) error { +func (c *MockFakeClient) Close(_ context.Context) error { c.closeCalled = true return nil } diff --git a/pkg/generator/acr/acr.go b/pkg/generator/acr/acr.go index 2aaea5731b6..64cf3e88a89 100644 --- a/pkg/generator/acr/acr.go +++ b/pkg/generator/acr/acr.go @@ -162,7 +162,7 @@ func (g *Generator) generate( type accessTokenFetcher func(acrRefreshToken, tenantID, registryURL, scope string) (string, error) -func fetchACRAccessToken(acrRefreshToken, tenantID, registryURL, scope string) (string, error) { +func fetchACRAccessToken(acrRefreshToken, _, registryURL, scope string) (string, error) { formData := url.Values{ "grant_type": {"refresh_token"}, "service": {registryURL}, diff --git a/pkg/generator/acr/acr_test.go b/pkg/generator/acr/acr_test.go index 29fe2f5f048..4f15568da36 100644 --- a/pkg/generator/acr/acr_test.go +++ b/pkg/generator/acr/acr_test.go @@ -213,6 +213,6 @@ type FakeTokenGetter struct { err error } -func (f *FakeTokenGetter) GetToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error) { +func (f *FakeTokenGetter) GetToken(_ context.Context, _ policy.TokenRequestOptions) (azcore.AccessToken, error) { return f.token, f.err } diff --git a/pkg/generator/fake/fake.go b/pkg/generator/fake/fake.go index 91c7fb50598..88ca9b9f5a1 100644 --- a/pkg/generator/fake/fake.go +++ b/pkg/generator/fake/fake.go @@ -33,7 +33,7 @@ const ( errGetToken = "unable to get authorization token: %w" ) -func (g *Generator) Generate(ctx context.Context, jsonSpec *apiextensions.JSON, kube client.Client, namespace string) (map[string][]byte, error) { +func (g *Generator) Generate(_ context.Context, jsonSpec *apiextensions.JSON, _ client.Client, _ string) (map[string][]byte, error) { if jsonSpec == nil { return nil, fmt.Errorf(errNoSpec) } diff --git a/pkg/generator/password/password.go b/pkg/generator/password/password.go index 2ab8871a8d2..5b48e0102d0 100644 --- a/pkg/generator/password/password.go +++ b/pkg/generator/password/password.go @@ -48,7 +48,7 @@ type generateFunc func( allowRepeat bool, ) (string, error) -func (g *Generator) Generate(ctx context.Context, jsonSpec *apiextensions.JSON, kube client.Client, namespace string) (map[string][]byte, error) { +func (g *Generator) Generate(_ context.Context, jsonSpec *apiextensions.JSON, _ client.Client, _ string) (map[string][]byte, error) { return g.generate( jsonSpec, generateSafePassword, diff --git a/pkg/provider/akeyless/akeyless.go b/pkg/provider/akeyless/akeyless.go index 4d01b65de1f..60b63fbfc59 100644 --- a/pkg/provider/akeyless/akeyless.go +++ b/pkg/provider/akeyless/akeyless.go @@ -212,7 +212,7 @@ func newClient(_ context.Context, store esv1beta1.GenericStore, kube client.Clie return &Akeyless{Client: akl, url: akeylessGwAPIURL}, nil } -func (a *Akeyless) Close(ctx context.Context) error { +func (a *Akeyless) Close(_ context.Context) error { return nil } @@ -227,11 +227,11 @@ func (a *Akeyless) Validate() (esv1beta1.ValidationResult, error) { return esv1beta1.ValidationResultReady, nil } -func (a *Akeyless) PushSecret(ctx context.Context, value []byte, remoteRef esv1beta1.PushRemoteRef) error { +func (a *Akeyless) PushSecret(_ context.Context, _ []byte, _ esv1beta1.PushRemoteRef) error { return fmt.Errorf("not implemented") } -func (a *Akeyless) DeleteSecret(ctx context.Context, remoteRef esv1beta1.PushRemoteRef) error { +func (a *Akeyless) DeleteSecret(_ context.Context, _ esv1beta1.PushRemoteRef) error { return fmt.Errorf("not implemented") } diff --git a/pkg/provider/akeyless/fake/fake.go b/pkg/provider/akeyless/fake/fake.go index 3d9ea29e521..20b59d03cc6 100644 --- a/pkg/provider/akeyless/fake/fake.go +++ b/pkg/provider/akeyless/fake/fake.go @@ -21,7 +21,7 @@ type AkeylessMockClient struct { getSecret func(secretName, token string, version int32) (string, error) } -func (mc *AkeylessMockClient) TokenFromSecretRef(ctx context.Context) (string, error) { +func (mc *AkeylessMockClient) TokenFromSecretRef(_ context.Context) (string, error) { return "newToken", nil } @@ -29,11 +29,11 @@ func (mc *AkeylessMockClient) GetSecretByType(_ context.Context, secretName, tok return mc.getSecret(secretName, token, version) } -func (mc *AkeylessMockClient) ListSecrets(ctx context.Context, path, tag, token string) ([]string, error) { +func (mc *AkeylessMockClient) ListSecrets(_ context.Context, _, _, _ string) ([]string, error) { return nil, nil } -func (mc *AkeylessMockClient) WithValue(in *Input, out *Output) { +func (mc *AkeylessMockClient) WithValue(_ *Input, out *Output) { if mc != nil { mc.getSecret = func(secretName, token string, version int32) (string, error) { return out.Value, out.Err diff --git a/pkg/provider/alibaba/fake/fake.go b/pkg/provider/alibaba/fake/fake.go index 9f91ceb2dfc..a7faafb276e 100644 --- a/pkg/provider/alibaba/fake/fake.go +++ b/pkg/provider/alibaba/fake/fake.go @@ -28,7 +28,7 @@ func (mc *AlibabaMockClient) GetSecretValue(context.Context, *kmssdk.GetSecretVa return mc.getSecretValue(&kmssdk.GetSecretValueRequest{}) } -func (mc *AlibabaMockClient) WithValue(in *kmssdk.GetSecretValueRequest, val *kmssdk.GetSecretValueResponseBody, err error) { +func (mc *AlibabaMockClient) WithValue(_ *kmssdk.GetSecretValueRequest, val *kmssdk.GetSecretValueResponseBody, err error) { if mc != nil { mc.getSecretValue = func(paramIn *kmssdk.GetSecretValueRequest) (*kmssdk.GetSecretValueResponseBody, error) { return val, err diff --git a/pkg/provider/alibaba/kms.go b/pkg/provider/alibaba/kms.go index 046d2a4a281..4dd11c4e9d3 100644 --- a/pkg/provider/alibaba/kms.go +++ b/pkg/provider/alibaba/kms.go @@ -58,16 +58,16 @@ type SMInterface interface { Endpoint() string } -func (kms *KeyManagementService) PushSecret(ctx context.Context, value []byte, remoteRef esv1beta1.PushRemoteRef) error { +func (kms *KeyManagementService) PushSecret(_ context.Context, _ []byte, _ esv1beta1.PushRemoteRef) error { return fmt.Errorf("not implemented") } -func (kms *KeyManagementService) DeleteSecret(ctx context.Context, remoteRef esv1beta1.PushRemoteRef) error { +func (kms *KeyManagementService) DeleteSecret(_ context.Context, _ esv1beta1.PushRemoteRef) error { return fmt.Errorf("not implemented") } // Empty GetAllSecrets. -func (kms *KeyManagementService) GetAllSecrets(ctx context.Context, ref esv1beta1.ExternalSecretFind) (map[string][]byte, error) { +func (kms *KeyManagementService) GetAllSecrets(_ context.Context, _ esv1beta1.ExternalSecretFind) (map[string][]byte, error) { // TO be implemented return nil, fmt.Errorf("GetAllSecrets not implemented") } @@ -278,7 +278,7 @@ func newAccessKeyAuth(ctx context.Context, kube kclient.Client, store esv1beta1. return credential.NewCredential(credentialConfig) } -func (kms *KeyManagementService) Close(ctx context.Context) error { +func (kms *KeyManagementService) Close(_ context.Context) error { return nil } diff --git a/pkg/provider/aws/auth/fake/assumeroler.go b/pkg/provider/aws/auth/fake/assumeroler.go index e3a0f604538..d805657aa35 100644 --- a/pkg/provider/aws/auth/fake/assumeroler.go +++ b/pkg/provider/aws/auth/fake/assumeroler.go @@ -30,7 +30,7 @@ func (f *AssumeRoler) AssumeRole(input *sts.AssumeRoleInput) (*sts.AssumeRoleOut return f.AssumeRoleFunc(input) } -func (f *AssumeRoler) AssumeRoleWithContext(ctx aws.Context, input *sts.AssumeRoleInput, opts ...request.Option) (*sts.AssumeRoleOutput, error) { +func (f *AssumeRoler) AssumeRoleWithContext(_ aws.Context, input *sts.AssumeRoleInput, _ ...request.Option) (*sts.AssumeRoleOutput, error) { return f.AssumeRoleFunc(input) } diff --git a/pkg/provider/aws/parameterstore/parameterstore.go b/pkg/provider/aws/parameterstore/parameterstore.go index 35e5bf21ffe..f5ae02306a1 100644 --- a/pkg/provider/aws/parameterstore/parameterstore.go +++ b/pkg/provider/aws/parameterstore/parameterstore.go @@ -416,7 +416,7 @@ func (pm *ParameterStore) GetSecretMap(ctx context.Context, ref esv1beta1.Extern return secretData, nil } -func (pm *ParameterStore) Close(ctx context.Context) error { +func (pm *ParameterStore) Close(_ context.Context) error { return nil } diff --git a/pkg/provider/aws/secretsmanager/fake/fake.go b/pkg/provider/aws/secretsmanager/fake/fake.go index 4c651e270d4..ff46adc8fca 100644 --- a/pkg/provider/aws/secretsmanager/fake/fake.go +++ b/pkg/provider/aws/secretsmanager/fake/fake.go @@ -54,7 +54,7 @@ func (sm Client) DeleteSecretWithContext(ctx aws.Context, input *awssm.DeleteSec } func NewDeleteSecretWithContextFn(output *awssm.DeleteSecretOutput, err error) DeleteSecretWithContextFn { - return func(ctx aws.Context, input *awssm.DeleteSecretInput, opts ...request.Option) (output *awssm.DeleteSecretOutput, err error) { + return func(ctx aws.Context, input *awssm.DeleteSecretInput, opts ...request.Option) (*awssm.DeleteSecretOutput, error) { return output, err } } diff --git a/pkg/provider/aws/secretsmanager/secretsmanager.go b/pkg/provider/aws/secretsmanager/secretsmanager.go index bfc1b911c5e..7bc9b4d7fe0 100644 --- a/pkg/provider/aws/secretsmanager/secretsmanager.go +++ b/pkg/provider/aws/secretsmanager/secretsmanager.go @@ -447,7 +447,7 @@ func (sm *SecretsManager) GetSecretMap(ctx context.Context, ref esv1beta1.Extern return secretData, nil } -func (sm *SecretsManager) Close(ctx context.Context) error { +func (sm *SecretsManager) Close(_ context.Context) error { return nil } diff --git a/pkg/provider/azure/keyvault/fake/fake.go b/pkg/provider/azure/keyvault/fake/fake.go index f0d3bf715b3..e58cb471a00 100644 --- a/pkg/provider/azure/keyvault/fake/fake.go +++ b/pkg/provider/azure/keyvault/fake/fake.go @@ -72,25 +72,25 @@ func (mc *AzureMockClient) DeleteCertificate(ctx context.Context, vaultBaseURL, return mc.deleteCertificate(ctx, vaultBaseURL, certificateName) } -func (mc *AzureMockClient) WithValue(serviceURL, secretName, secretVersion string, apiOutput keyvault.SecretBundle, err error) { +func (mc *AzureMockClient) WithValue(_, _, _ string, apiOutput keyvault.SecretBundle, err error) { if mc != nil { - mc.getSecret = func(ctx context.Context, serviceURL, secretName, secretVersion string) (result keyvault.SecretBundle, retErr error) { + mc.getSecret = func(_ context.Context, _, _, _ string) (result keyvault.SecretBundle, retErr error) { return apiOutput, err } } } -func (mc *AzureMockClient) WithKey(serviceURL, secretName, secretVersion string, apiOutput keyvault.KeyBundle, err error) { +func (mc *AzureMockClient) WithKey(_, _, _ string, apiOutput keyvault.KeyBundle, err error) { if mc != nil { - mc.getKey = func(ctx context.Context, vaultBaseURL, keyName, keyVersion string) (result keyvault.KeyBundle, retErr error) { + mc.getKey = func(_ context.Context, _, _, _ string) (result keyvault.KeyBundle, retErr error) { return apiOutput, err } } } -func (mc *AzureMockClient) WithCertificate(serviceURL, secretName, secretVersion string, apiOutput keyvault.CertificateBundle, err error) { +func (mc *AzureMockClient) WithCertificate(_, _, _ string, apiOutput keyvault.CertificateBundle, err error) { if mc != nil { - mc.getCertificate = func(ctx context.Context, vaultBaseURL, keyName, keyVersion string) (result keyvault.CertificateBundle, retErr error) { + mc.getCertificate = func(_ context.Context, _, _, _ string) (result keyvault.CertificateBundle, retErr error) { return apiOutput, err } } @@ -98,7 +98,7 @@ func (mc *AzureMockClient) WithCertificate(serviceURL, secretName, secretVersion func (mc *AzureMockClient) WithImportCertificate(apiOutput keyvault.CertificateBundle, err error) { if mc != nil { - mc.importCertificate = func(ctx context.Context, vaultBaseURL string, certificateName string, parameters keyvault.CertificateImportParameters) (keyvault.CertificateBundle, error) { + mc.importCertificate = func(_ context.Context, _ string, _ string, _ keyvault.CertificateImportParameters) (keyvault.CertificateBundle, error) { return apiOutput, err } } @@ -106,7 +106,7 @@ func (mc *AzureMockClient) WithImportCertificate(apiOutput keyvault.CertificateB func (mc *AzureMockClient) WithImportKey(output keyvault.KeyBundle, err error) { if mc != nil { - mc.importKey = func(ctx context.Context, vaultBaseURL string, keyName string, parameters keyvault.KeyImportParameters) (keyvault.KeyBundle, error) { + mc.importKey = func(_ context.Context, _ string, _ string, _ keyvault.KeyImportParameters) (keyvault.KeyBundle, error) { return output, err } } @@ -114,7 +114,7 @@ func (mc *AzureMockClient) WithImportKey(output keyvault.KeyBundle, err error) { func (mc *AzureMockClient) WithSetSecret(output keyvault.SecretBundle, err error) { if mc != nil { - mc.setSecret = func(ctx context.Context, vaultBaseURL string, secretName string, parameters keyvault.SecretSetParameters) (keyvault.SecretBundle, error) { + mc.setSecret = func(_ context.Context, _, _ string, _ keyvault.SecretSetParameters) (keyvault.SecretBundle, error) { return output, err } } @@ -122,7 +122,7 @@ func (mc *AzureMockClient) WithSetSecret(output keyvault.SecretBundle, err error func (mc *AzureMockClient) WithDeleteSecret(output keyvault.DeletedSecretBundle, err error) { if mc != nil { - mc.deleteSecret = func(ctx context.Context, vaultBaseURL string, secretName string) (keyvault.DeletedSecretBundle, error) { + mc.deleteSecret = func(_ context.Context, _, _ string) (keyvault.DeletedSecretBundle, error) { return output, err } } @@ -130,7 +130,7 @@ func (mc *AzureMockClient) WithDeleteSecret(output keyvault.DeletedSecretBundle, func (mc *AzureMockClient) WithDeleteCertificate(output keyvault.DeletedCertificateBundle, err error) { if mc != nil { - mc.deleteCertificate = func(ctx context.Context, vaultBaseURL string, certificateName string) (keyvault.DeletedCertificateBundle, error) { + mc.deleteCertificate = func(_ context.Context, _, _ string) (keyvault.DeletedCertificateBundle, error) { return output, err } } @@ -138,15 +138,15 @@ func (mc *AzureMockClient) WithDeleteCertificate(output keyvault.DeletedCertific func (mc *AzureMockClient) WithDeleteKey(output keyvault.DeletedKeyBundle, err error) { if mc != nil { - mc.deleteKey = func(ctx context.Context, vaultBaseURL string, keyName string) (keyvault.DeletedKeyBundle, error) { + mc.deleteKey = func(_ context.Context, _, _ string) (keyvault.DeletedKeyBundle, error) { return output, err } } } -func (mc *AzureMockClient) WithList(serviceURL string, apiOutput keyvault.SecretListResultIterator, err error) { +func (mc *AzureMockClient) WithList(_ string, apiOutput keyvault.SecretListResultIterator, err error) { if mc != nil { - mc.getSecretsComplete = func(ctx context.Context, vaultBaseURL string, maxresults *int32) (result keyvault.SecretListResultIterator, err error) { + mc.getSecretsComplete = func(_ context.Context, _ string, _ *int32) (keyvault.SecretListResultIterator, error) { return apiOutput, err } } diff --git a/pkg/provider/azure/keyvault/keyvault.go b/pkg/provider/azure/keyvault/keyvault.go index 7d4c76dbb01..713bce6a999 100644 --- a/pkg/provider/azure/keyvault/keyvault.go +++ b/pkg/provider/azure/keyvault/keyvault.go @@ -517,7 +517,7 @@ func (a *Azure) GetAllSecrets(ctx context.Context, ref esv1beta1.ExternalSecretF checkTags := len(ref.Tags) > 0 checkName := ref.Name != nil && len(ref.Name.RegExp) > 0 - secretListIter, err := basicClient.GetSecretsComplete(context.Background(), *a.provider.VaultURL, nil) + secretListIter, err := basicClient.GetSecretsComplete(ctx, *a.provider.VaultURL, nil) err = parseError(err) if err != nil { return nil, err @@ -531,7 +531,7 @@ func (a *Azure) GetAllSecrets(ctx context.Context, ref esv1beta1.ExternalSecretF continue } - secretResp, err := basicClient.GetSecret(context.Background(), *a.provider.VaultURL, secretName, "") + secretResp, err := basicClient.GetSecret(ctx, *a.provider.VaultURL, secretName, "") err = parseError(err) if err != nil { return nil, err @@ -617,7 +617,7 @@ func (a *Azure) GetSecret(ctx context.Context, ref esv1beta1.ExternalSecretDataR case defaultObjType: // returns a SecretBundle with the secret value // https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/services/keyvault/v7.0/keyvault#SecretBundle - secretResp, err := a.baseClient.GetSecret(context.Background(), *a.provider.VaultURL, secretName, ref.Version) + secretResp, err := a.baseClient.GetSecret(ctx, *a.provider.VaultURL, secretName, ref.Version) metrics.ObserveAPICall(metrics.ProviderAzureKV, metrics.CallAzureKVGetSecret, err) err = parseError(err) if err != nil { @@ -630,7 +630,7 @@ func (a *Azure) GetSecret(ctx context.Context, ref esv1beta1.ExternalSecretDataR case objectTypeCert: // returns a CertBundle. We return CER contents of x509 certificate // see: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/services/keyvault/v7.0/keyvault#CertificateBundle - certResp, err := a.baseClient.GetCertificate(context.Background(), *a.provider.VaultURL, secretName, ref.Version) + certResp, err := a.baseClient.GetCertificate(ctx, *a.provider.VaultURL, secretName, ref.Version) metrics.ObserveAPICall(metrics.ProviderAzureKV, metrics.CallAzureKVGetCertificate, err) err = parseError(err) if err != nil { @@ -644,7 +644,7 @@ func (a *Azure) GetSecret(ctx context.Context, ref esv1beta1.ExternalSecretDataR // returns a KeyBundle that contains a jwk // azure kv returns only public keys // see: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/services/keyvault/v7.0/keyvault#KeyBundle - keyResp, err := a.baseClient.GetKey(context.Background(), *a.provider.VaultURL, secretName, ref.Version) + keyResp, err := a.baseClient.GetKey(ctx, *a.provider.VaultURL, secretName, ref.Version) metrics.ObserveAPICall(metrics.ProviderAzureKV, metrics.CallAzureKVGetKey, err) err = parseError(err) if err != nil { @@ -660,9 +660,9 @@ func (a *Azure) GetSecret(ctx context.Context, ref esv1beta1.ExternalSecretDataR } // returns a SecretBundle with the tags values. -func (a *Azure) getSecretTags(ref esv1beta1.ExternalSecretDataRemoteRef) (map[string]*string, error) { +func (a *Azure) getSecretTags(ctx context.Context, ref esv1beta1.ExternalSecretDataRemoteRef) (map[string]*string, error) { _, secretName := getObjType(ref) - secretResp, err := a.baseClient.GetSecret(context.Background(), *a.provider.VaultURL, secretName, ref.Version) + secretResp, err := a.baseClient.GetSecret(ctx, *a.provider.VaultURL, secretName, ref.Version) metrics.ObserveAPICall(metrics.ProviderAzureKV, metrics.CallAzureKVGetSecret, err) err = parseError(err) if err != nil { @@ -701,7 +701,7 @@ func (a *Azure) GetSecretMap(ctx context.Context, ref esv1beta1.ExternalSecretDa } if ref.MetadataPolicy == esv1beta1.ExternalSecretMetadataPolicyFetch { - tags, _ := a.getSecretTags(ref) + tags, _ := a.getSecretTags(ctx, ref) return getSecretMapProperties(tags, ref.Key, ref.Property), nil } @@ -917,7 +917,7 @@ func (a *Azure) secretKeyRef(ctx context.Context, namespace string, secretRef sm return value, nil } -func (a *Azure) Close(ctx context.Context) error { +func (a *Azure) Close(_ context.Context) error { return nil } diff --git a/pkg/provider/doppler/client.go b/pkg/provider/doppler/client.go index ee42e87a3be..757d9176220 100644 --- a/pkg/provider/doppler/client.go +++ b/pkg/provider/doppler/client.go @@ -115,11 +115,11 @@ func (c *Client) Validate() (esv1beta1.ValidationResult, error) { return esv1beta1.ValidationResultReady, nil } -func (c *Client) DeleteSecret(ctx context.Context, remoteRef esv1beta1.PushRemoteRef) error { +func (c *Client) DeleteSecret(_ context.Context, _ esv1beta1.PushRemoteRef) error { return fmt.Errorf("not implemented") } -func (c *Client) PushSecret(ctx context.Context, value []byte, remoteRef esv1beta1.PushRemoteRef) error { +func (c *Client) PushSecret(_ context.Context, _ []byte, _ esv1beta1.PushRemoteRef) error { return fmt.Errorf("not implemented") } diff --git a/pkg/provider/doppler/fake/fake.go b/pkg/provider/doppler/fake/fake.go index 3130482dfdb..ff7092eecbb 100644 --- a/pkg/provider/doppler/fake/fake.go +++ b/pkg/provider/doppler/fake/fake.go @@ -38,7 +38,7 @@ func (dc *DopplerClient) GetSecret(request client.SecretRequest) (*client.Secret return dc.getSecret(request) } -func (dc *DopplerClient) GetSecrets(request client.SecretsRequest) (*client.SecretsResponse, error) { +func (dc *DopplerClient) GetSecrets(_ client.SecretsRequest) (*client.SecretsResponse, error) { // Not implemented return &client.SecretsResponse{}, nil } diff --git a/pkg/provider/fake/fake.go b/pkg/provider/fake/fake.go index b6b52de0afc..7f1500e814f 100644 --- a/pkg/provider/fake/fake.go +++ b/pkg/provider/fake/fake.go @@ -55,7 +55,7 @@ func (p *Provider) Capabilities() esv1beta1.SecretStoreCapabilities { return esv1beta1.SecretStoreReadWrite } -func (p *Provider) NewClient(ctx context.Context, store esv1beta1.GenericStore, kube client.Client, namespace string) (esv1beta1.SecretsClient, error) { +func (p *Provider) NewClient(_ context.Context, store esv1beta1.GenericStore, _ client.Client, _ string) (esv1beta1.SecretsClient, error) { if p.database == nil { p.database = make(map[string]Config) } @@ -102,11 +102,11 @@ func getProvider(store esv1beta1.GenericStore) (*esv1beta1.FakeProvider, error) return spc.Provider.Fake, nil } -func (p *Provider) DeleteSecret(ctx context.Context, remoteRef esv1beta1.PushRemoteRef) error { +func (p *Provider) DeleteSecret(_ context.Context, _ esv1beta1.PushRemoteRef) error { return nil } -func (p *Provider) PushSecret(ctx context.Context, value []byte, remoteRef esv1beta1.PushRemoteRef) error { +func (p *Provider) PushSecret(_ context.Context, value []byte, remoteRef esv1beta1.PushRemoteRef) error { currentData, ok := p.config[remoteRef.GetRemoteKey()] if !ok { p.config[remoteRef.GetRemoteKey()] = &Data{ @@ -123,13 +123,13 @@ func (p *Provider) PushSecret(ctx context.Context, value []byte, remoteRef esv1b } // Empty GetAllSecrets. -func (p *Provider) GetAllSecrets(ctx context.Context, ref esv1beta1.ExternalSecretFind) (map[string][]byte, error) { +func (p *Provider) GetAllSecrets(_ context.Context, _ esv1beta1.ExternalSecretFind) (map[string][]byte, error) { // TO be implemented return nil, fmt.Errorf("GetAllSecrets not implemented") } // GetSecret returns a single secret from the provider. -func (p *Provider) GetSecret(ctx context.Context, ref esv1beta1.ExternalSecretDataRemoteRef) ([]byte, error) { +func (p *Provider) GetSecret(_ context.Context, ref esv1beta1.ExternalSecretDataRemoteRef) ([]byte, error) { mapKey := fmt.Sprintf("%v%v", ref.Key, ref.Version) data, ok := p.config[mapKey] if !ok || data.Version != ref.Version { @@ -149,7 +149,7 @@ func (p *Provider) GetSecret(ctx context.Context, ref esv1beta1.ExternalSecretDa } // GetSecretMap returns multiple k/v pairs from the provider. -func (p *Provider) GetSecretMap(ctx context.Context, ref esv1beta1.ExternalSecretDataRemoteRef) (map[string][]byte, error) { +func (p *Provider) GetSecretMap(_ context.Context, ref esv1beta1.ExternalSecretDataRemoteRef) (map[string][]byte, error) { mapKey := fmt.Sprintf("%v%v", ref.Key, ref.Version) data, ok := p.config[mapKey] if !ok || data.Version != ref.Version || data.ValueMap == nil { @@ -166,7 +166,7 @@ func convertMap(in map[string]string) map[string][]byte { return m } -func (p *Provider) Close(ctx context.Context) error { +func (p *Provider) Close(_ context.Context) error { return nil } diff --git a/pkg/provider/gcp/secretmanager/client.go b/pkg/provider/gcp/secretmanager/client.go index 9ec8e00a510..991ef773d7d 100644 --- a/pkg/provider/gcp/secretmanager/client.go +++ b/pkg/provider/gcp/secretmanager/client.go @@ -487,7 +487,7 @@ func (c *Client) GetSecretMap(ctx context.Context, ref esv1beta1.ExternalSecretD return secretData, nil } -func (c *Client) Close(ctx context.Context) error { +func (c *Client) Close(_ context.Context) error { var err error if c.smClient != nil { err = c.smClient.Close() diff --git a/pkg/provider/gcp/secretmanager/fake/fake.go b/pkg/provider/gcp/secretmanager/fake/fake.go index 8170436116f..107c224a3e5 100644 --- a/pkg/provider/gcp/secretmanager/fake/fake.go +++ b/pkg/provider/gcp/secretmanager/fake/fake.go @@ -55,57 +55,57 @@ type CreateSecretMockReturn struct { Err error } -func (mc *MockSMClient) DeleteSecret(ctx context.Context, req *secretmanagerpb.DeleteSecretRequest, opts ...gax.CallOption) error { +func (mc *MockSMClient) DeleteSecret(ctx context.Context, req *secretmanagerpb.DeleteSecretRequest, _ ...gax.CallOption) error { return mc.DeleteSecretFn(ctx, req) } func (mc *MockSMClient) NewDeleteSecretFn(err error) { - mc.DeleteSecretFn = func(ctx context.Context, req *secretmanagerpb.DeleteSecretRequest, opts ...gax.CallOption) error { + mc.DeleteSecretFn = func(_ context.Context, _ *secretmanagerpb.DeleteSecretRequest, _ ...gax.CallOption) error { return err } } -func (mc *MockSMClient) GetSecret(ctx context.Context, req *secretmanagerpb.GetSecretRequest, opts ...gax.CallOption) (*secretmanagerpb.Secret, error) { +func (mc *MockSMClient) GetSecret(ctx context.Context, req *secretmanagerpb.GetSecretRequest, _ ...gax.CallOption) (*secretmanagerpb.Secret, error) { return mc.GetSecretFn(ctx, req) } func (mc *MockSMClient) NewGetSecretFn(mock GetSecretMockReturn) { - mc.GetSecretFn = func(ctx context.Context, req *secretmanagerpb.GetSecretRequest, opts ...gax.CallOption) (*secretmanagerpb.Secret, error) { + mc.GetSecretFn = func(_ context.Context, _ *secretmanagerpb.GetSecretRequest, _ ...gax.CallOption) (*secretmanagerpb.Secret, error) { return mock.Secret, mock.Err } } -func (mc *MockSMClient) AccessSecretVersion(ctx context.Context, req *secretmanagerpb.AccessSecretVersionRequest, opts ...gax.CallOption) (*secretmanagerpb.AccessSecretVersionResponse, error) { +func (mc *MockSMClient) AccessSecretVersion(ctx context.Context, req *secretmanagerpb.AccessSecretVersionRequest, _ ...gax.CallOption) (*secretmanagerpb.AccessSecretVersionResponse, error) { return mc.accessSecretFn(ctx, req) } func (mc *MockSMClient) NewAccessSecretVersionFn(mock AccessSecretVersionMockReturn) { - mc.accessSecretFn = func(ctx context.Context, req *secretmanagerpb.AccessSecretVersionRequest, opts ...gax.CallOption) (*secretmanagerpb.AccessSecretVersionResponse, error) { + mc.accessSecretFn = func(_ context.Context, _ *secretmanagerpb.AccessSecretVersionRequest, _ ...gax.CallOption) (*secretmanagerpb.AccessSecretVersionResponse, error) { return mock.Res, mock.Err } } -func (mc *MockSMClient) ListSecrets(ctx context.Context, req *secretmanagerpb.ListSecretsRequest, opts ...gax.CallOption) *secretmanager.SecretIterator { +func (mc *MockSMClient) ListSecrets(ctx context.Context, req *secretmanagerpb.ListSecretsRequest, _ ...gax.CallOption) *secretmanager.SecretIterator { return mc.ListSecretsFn(ctx, req) } func (mc *MockSMClient) Close() error { return mc.closeFn() } -func (mc *MockSMClient) AddSecretVersion(ctx context.Context, req *secretmanagerpb.AddSecretVersionRequest, opts ...gax.CallOption) (*secretmanagerpb.SecretVersion, error) { +func (mc *MockSMClient) AddSecretVersion(ctx context.Context, req *secretmanagerpb.AddSecretVersionRequest, _ ...gax.CallOption) (*secretmanagerpb.SecretVersion, error) { return mc.addSecretFn(ctx, req) } func (mc *MockSMClient) NewAddSecretVersionFn(mock AddSecretVersionMockReturn) { - mc.addSecretFn = func(ctx context.Context, req *secretmanagerpb.AddSecretVersionRequest, opts ...gax.CallOption) (*secretmanagerpb.SecretVersion, error) { + mc.addSecretFn = func(_ context.Context, _ *secretmanagerpb.AddSecretVersionRequest, _ ...gax.CallOption) (*secretmanagerpb.SecretVersion, error) { return mock.SecretVersion, mock.Err } } -func (mc *MockSMClient) CreateSecret(ctx context.Context, req *secretmanagerpb.CreateSecretRequest, opts ...gax.CallOption) (*secretmanagerpb.Secret, error) { +func (mc *MockSMClient) CreateSecret(ctx context.Context, req *secretmanagerpb.CreateSecretRequest, _ ...gax.CallOption) (*secretmanagerpb.Secret, error) { return mc.createSecretFn(ctx, req) } func (mc *MockSMClient) NewCreateSecretFn(mock CreateSecretMockReturn) { - mc.createSecretFn = func(ctx context.Context, req *secretmanagerpb.CreateSecretRequest, opts ...gax.CallOption) (*secretmanagerpb.Secret, error) { + mc.createSecretFn = func(_ context.Context, _ *secretmanagerpb.CreateSecretRequest, _ ...gax.CallOption) (*secretmanagerpb.Secret, error) { return mock.Secret, mock.Err } } @@ -177,7 +177,7 @@ func (mc *MockSMClient) AccessSecretVersionWithError(err error) { } } -func (mc *MockSMClient) WithValue(ctx context.Context, req *secretmanagerpb.AccessSecretVersionRequest, val *secretmanagerpb.AccessSecretVersionResponse, err error) { +func (mc *MockSMClient) WithValue(_ context.Context, req *secretmanagerpb.AccessSecretVersionRequest, val *secretmanagerpb.AccessSecretVersionResponse, err error) { if mc != nil { mc.accessSecretFn = func(paramCtx context.Context, paramReq *secretmanagerpb.AccessSecretVersionRequest, paramOpts ...gax.CallOption) (*secretmanagerpb.AccessSecretVersionResponse, error) { // type secretmanagerpb.AccessSecretVersionRequest contains unexported fields diff --git a/pkg/provider/gcp/secretmanager/workload_identity_test.go b/pkg/provider/gcp/secretmanager/workload_identity_test.go index 653b9b7dccc..52125cd89cb 100644 --- a/pkg/provider/gcp/secretmanager/workload_identity_test.go +++ b/pkg/provider/gcp/secretmanager/workload_identity_test.go @@ -420,7 +420,7 @@ type fakeK8sV1 struct { k8sv1.CoreV1Interface } -func (m *fakeK8sV1) ServiceAccounts(namespace string) k8sv1.ServiceAccountInterface { +func (m *fakeK8sV1) ServiceAccounts(_ string) k8sv1.ServiceAccountInterface { return &fakeK8sV1SA{v1mock: m} } @@ -431,10 +431,10 @@ type fakeK8sV1SA struct { } func (ma *fakeK8sV1SA) CreateToken( - ctx context.Context, - serviceAccountName string, + _ context.Context, + _ string, tokenRequest *authv1.TokenRequest, - opts metav1.CreateOptions, + _ metav1.CreateOptions, ) (*authv1.TokenRequest, error) { tokenRequest.Status.Token = defaultSAToken return tokenRequest, nil diff --git a/pkg/provider/gitlab/fake/fake.go b/pkg/provider/gitlab/fake/fake.go index 5bf47873a0e..50397bf5d45 100644 --- a/pkg/provider/gitlab/fake/fake.go +++ b/pkg/provider/gitlab/fake/fake.go @@ -44,7 +44,7 @@ type GitlabMockProjectsClient struct { listProjectsGroups func(pid interface{}, opt *gitlab.ListProjectGroupOptions, options ...gitlab.RequestOptionFunc) ([]*gitlab.ProjectGroup, *gitlab.Response, error) } -func (mc *GitlabMockProjectsClient) ListProjectsGroups(pid interface{}, opt *gitlab.ListProjectGroupOptions, options ...gitlab.RequestOptionFunc) ([]*gitlab.ProjectGroup, *gitlab.Response, error) { +func (mc *GitlabMockProjectsClient) ListProjectsGroups(pid interface{}, opt *gitlab.ListProjectGroupOptions, _ ...gitlab.RequestOptionFunc) ([]*gitlab.ProjectGroup, *gitlab.Response, error) { return mc.listProjectsGroups(pid, opt, nil) } @@ -61,11 +61,11 @@ type GitlabMockProjectVariablesClient struct { listVariables func(pid interface{}, options ...gitlab.RequestOptionFunc) ([]*gitlab.ProjectVariable, *gitlab.Response, error) } -func (mc *GitlabMockProjectVariablesClient) GetVariable(pid interface{}, key string, opt *gitlab.GetProjectVariableOptions, options ...gitlab.RequestOptionFunc) (*gitlab.ProjectVariable, *gitlab.Response, error) { +func (mc *GitlabMockProjectVariablesClient) GetVariable(pid interface{}, key string, _ *gitlab.GetProjectVariableOptions, _ ...gitlab.RequestOptionFunc) (*gitlab.ProjectVariable, *gitlab.Response, error) { return mc.getVariable(pid, key, nil) } -func (mc *GitlabMockProjectVariablesClient) ListVariables(pid interface{}, opt *gitlab.ListProjectVariablesOptions, options ...gitlab.RequestOptionFunc) ([]*gitlab.ProjectVariable, *gitlab.Response, error) { +func (mc *GitlabMockProjectVariablesClient) ListVariables(pid interface{}, _ *gitlab.ListProjectVariablesOptions, _ ...gitlab.RequestOptionFunc) ([]*gitlab.ProjectVariable, *gitlab.Response, error) { return mc.listVariables(pid) } @@ -134,11 +134,11 @@ type GitlabMockGroupVariablesClient struct { listVariables func(gid interface{}, options ...gitlab.RequestOptionFunc) ([]*gitlab.GroupVariable, *gitlab.Response, error) } -func (mc *GitlabMockGroupVariablesClient) GetVariable(gid interface{}, key string, options ...gitlab.RequestOptionFunc) (*gitlab.GroupVariable, *gitlab.Response, error) { +func (mc *GitlabMockGroupVariablesClient) GetVariable(gid interface{}, key string, _ ...gitlab.RequestOptionFunc) (*gitlab.GroupVariable, *gitlab.Response, error) { return mc.getVariable(gid, key, nil) } -func (mc *GitlabMockGroupVariablesClient) ListVariables(gid interface{}, opt *gitlab.ListGroupVariablesOptions, options ...gitlab.RequestOptionFunc) ([]*gitlab.GroupVariable, *gitlab.Response, error) { +func (mc *GitlabMockGroupVariablesClient) ListVariables(gid interface{}, _ *gitlab.ListGroupVariablesOptions, _ ...gitlab.RequestOptionFunc) ([]*gitlab.GroupVariable, *gitlab.Response, error) { return mc.listVariables(gid) } diff --git a/pkg/provider/gitlab/gitlab.go b/pkg/provider/gitlab/gitlab.go index 1360ccd15a2..14757a13369 100644 --- a/pkg/provider/gitlab/gitlab.go +++ b/pkg/provider/gitlab/gitlab.go @@ -107,16 +107,16 @@ func (g *gitlabBase) getAuth(ctx context.Context) ([]byte, error) { return credentials, nil } -func (g *gitlabBase) DeleteSecret(ctx context.Context, remoteRef esv1beta1.PushRemoteRef) error { +func (g *gitlabBase) DeleteSecret(_ context.Context, _ esv1beta1.PushRemoteRef) error { return fmt.Errorf("not implemented") } -func (g *gitlabBase) PushSecret(ctx context.Context, value []byte, remoteRef esv1beta1.PushRemoteRef) error { +func (g *gitlabBase) PushSecret(_ context.Context, _ []byte, _ esv1beta1.PushRemoteRef) error { return fmt.Errorf("not implemented") } // GetAllSecrets syncs all gitlab project and group variables into a single Kubernetes Secret. -func (g *gitlabBase) GetAllSecrets(ctx context.Context, ref esv1beta1.ExternalSecretFind) (map[string][]byte, error) { +func (g *gitlabBase) GetAllSecrets(_ context.Context, ref esv1beta1.ExternalSecretFind) (map[string][]byte, error) { if utils.IsNil(g.projectVariablesClient) { return nil, fmt.Errorf(errUninitializedGitlabProvider) } @@ -215,7 +215,7 @@ func ExtractTag(tags map[string]string) (string, error) { return environmentScope, nil } -func (g *gitlabBase) GetSecret(ctx context.Context, ref esv1beta1.ExternalSecretDataRemoteRef) ([]byte, error) { +func (g *gitlabBase) GetSecret(_ context.Context, ref esv1beta1.ExternalSecretDataRemoteRef) ([]byte, error) { if utils.IsNil(g.projectVariablesClient) || utils.IsNil(g.groupVariablesClient) { return nil, fmt.Errorf(errUninitializedGitlabProvider) } @@ -342,7 +342,7 @@ func matchesFilter(environment, varEnvironment, key string, matcher *find.Matche return true, key, isWildcard } -func (g *gitlabBase) Close(ctx context.Context) error { +func (g *gitlabBase) Close(_ context.Context) error { return nil } diff --git a/pkg/provider/ibm/provider.go b/pkg/provider/ibm/provider.go index be471d2634a..2b5e8fa14f0 100644 --- a/pkg/provider/ibm/provider.go +++ b/pkg/provider/ibm/provider.go @@ -102,22 +102,22 @@ func (c *client) setAuth(ctx context.Context) error { return nil } -func (ibm *providerIBM) DeleteSecret(ctx context.Context, remoteRef esv1beta1.PushRemoteRef) error { +func (ibm *providerIBM) DeleteSecret(_ context.Context, _ esv1beta1.PushRemoteRef) error { return fmt.Errorf("not implemented") } // Not Implemented PushSecret. -func (ibm *providerIBM) PushSecret(ctx context.Context, value []byte, remoteRef esv1beta1.PushRemoteRef) error { +func (ibm *providerIBM) PushSecret(_ context.Context, _ []byte, _ esv1beta1.PushRemoteRef) error { return fmt.Errorf("not implemented") } // Empty GetAllSecrets. -func (ibm *providerIBM) GetAllSecrets(ctx context.Context, ref esv1beta1.ExternalSecretFind) (map[string][]byte, error) { +func (ibm *providerIBM) GetAllSecrets(_ context.Context, _ esv1beta1.ExternalSecretFind) (map[string][]byte, error) { // TO be implemented return nil, fmt.Errorf("GetAllSecrets not implemented") } -func (ibm *providerIBM) GetSecret(ctx context.Context, ref esv1beta1.ExternalSecretDataRemoteRef) ([]byte, error) { +func (ibm *providerIBM) GetSecret(_ context.Context, ref esv1beta1.ExternalSecretDataRemoteRef) ([]byte, error) { if utils.IsNil(ibm.IBMClient) { return nil, fmt.Errorf(errUninitalizedIBMProvider) } @@ -374,7 +374,7 @@ func getSecretByType(ibm *providerIBM, secretName *string, secretType string) (* return secret, nil } -func (ibm *providerIBM) GetSecretMap(ctx context.Context, ref esv1beta1.ExternalSecretDataRemoteRef) (map[string][]byte, error) { +func (ibm *providerIBM) GetSecretMap(_ context.Context, ref esv1beta1.ExternalSecretDataRemoteRef) (map[string][]byte, error) { if utils.IsNil(ibm.IBMClient) { return nil, fmt.Errorf(errUninitalizedIBMProvider) } @@ -560,7 +560,7 @@ func getTypedKey(v interface{}) ([]byte, error) { } } -func (ibm *providerIBM) Close(ctx context.Context) error { +func (ibm *providerIBM) Close(_ context.Context) error { return nil } diff --git a/pkg/provider/keepersecurity/client.go b/pkg/provider/keepersecurity/client.go index 9215513da96..73e9ec3c6b5 100644 --- a/pkg/provider/keepersecurity/client.go +++ b/pkg/provider/keepersecurity/client.go @@ -97,7 +97,7 @@ func (c *Client) Validate() (esv1beta1.ValidationResult, error) { return esv1beta1.ValidationResultReady, nil } -func (c *Client) GetSecret(ctx context.Context, ref esv1beta1.ExternalSecretDataRemoteRef) ([]byte, error) { +func (c *Client) GetSecret(_ context.Context, ref esv1beta1.ExternalSecretDataRemoteRef) ([]byte, error) { record, err := c.findSecretByID(ref.Key) if err != nil { return nil, err @@ -110,7 +110,7 @@ func (c *Client) GetSecret(ctx context.Context, ref esv1beta1.ExternalSecretData return secret.getItem(ref) } -func (c *Client) GetSecretMap(ctx context.Context, ref esv1beta1.ExternalSecretDataRemoteRef) (map[string][]byte, error) { +func (c *Client) GetSecretMap(_ context.Context, ref esv1beta1.ExternalSecretDataRemoteRef) (map[string][]byte, error) { record, err := c.findSecretByID(ref.Key) if err != nil { return nil, err @@ -123,7 +123,7 @@ func (c *Client) GetSecretMap(ctx context.Context, ref esv1beta1.ExternalSecretD return secret.getItems(ref) } -func (c *Client) GetAllSecrets(ctx context.Context, ref esv1beta1.ExternalSecretFind) (map[string][]byte, error) { +func (c *Client) GetAllSecrets(_ context.Context, ref esv1beta1.ExternalSecretFind) (map[string][]byte, error) { if ref.Tags != nil { return nil, fmt.Errorf(errTagsNotImplemented) } @@ -156,11 +156,11 @@ func (c *Client) GetAllSecrets(ctx context.Context, ref esv1beta1.ExternalSecret return secretData, nil } -func (c *Client) Close(ctx context.Context) error { +func (c *Client) Close(_ context.Context) error { return nil } -func (c *Client) PushSecret(ctx context.Context, value []byte, remoteRef esv1beta1.PushRemoteRef) error { +func (c *Client) PushSecret(_ context.Context, value []byte, remoteRef esv1beta1.PushRemoteRef) error { parts, err := c.buildSecretNameAndKey(remoteRef) if err != nil { return err @@ -185,7 +185,7 @@ func (c *Client) PushSecret(ctx context.Context, value []byte, remoteRef esv1bet return nil } -func (c *Client) DeleteSecret(ctx context.Context, remoteRef esv1beta1.PushRemoteRef) error { +func (c *Client) DeleteSecret(_ context.Context, remoteRef esv1beta1.PushRemoteRef) error { parts, err := c.buildSecretNameAndKey(remoteRef) if err != nil { return err diff --git a/pkg/provider/kubernetes/client.go b/pkg/provider/kubernetes/client.go index 0cd87b318a8..3d46b9c4baa 100644 --- a/pkg/provider/kubernetes/client.go +++ b/pkg/provider/kubernetes/client.go @@ -102,12 +102,12 @@ func getSecretValues(secretMap map[string][]byte, policy esv1beta1.ExternalSecre return byteArr, nil } -func (c *Client) DeleteSecret(ctx context.Context, remoteRef esv1beta1.PushRemoteRef) error { +func (c *Client) DeleteSecret(_ context.Context, _ esv1beta1.PushRemoteRef) error { return fmt.Errorf("not implemented") } // Not Implemented PushSecret. -func (c *Client) PushSecret(ctx context.Context, value []byte, remoteRef esv1beta1.PushRemoteRef) error { +func (c *Client) PushSecret(_ context.Context, _ []byte, _ esv1beta1.PushRemoteRef) error { return fmt.Errorf("not implemented") } @@ -266,7 +266,7 @@ func (c *Client) findByName(ctx context.Context, ref esv1beta1.ExternalSecretFin return utils.ConvertKeys(ref.ConversionStrategy, data) } -func (c Client) Close(ctx context.Context) error { +func (c Client) Close(_ context.Context) error { return nil } diff --git a/pkg/provider/kubernetes/client_test.go b/pkg/provider/kubernetes/client_test.go index 3e883f8cf91..0871b391fe1 100644 --- a/pkg/provider/kubernetes/client_test.go +++ b/pkg/provider/kubernetes/client_test.go @@ -39,7 +39,7 @@ type fakeClient struct { err error } -func (fk fakeClient) Get(ctx context.Context, name string, opts metav1.GetOptions) (*corev1.Secret, error) { +func (fk fakeClient) Get(_ context.Context, name string, _ metav1.GetOptions) (*corev1.Secret, error) { secret, ok := fk.secretMap[name] if !ok { @@ -48,7 +48,7 @@ func (fk fakeClient) Get(ctx context.Context, name string, opts metav1.GetOption return &secret, fk.err } -func (fk fakeClient) List(ctx context.Context, opts metav1.ListOptions) (*corev1.SecretList, error) { +func (fk fakeClient) List(_ context.Context, opts metav1.ListOptions) (*corev1.SecretList, error) { assert.Equal(fk.t, fk.expectedListOptions, opts) list := &corev1.SecretList{} for _, v := range fk.secretMap { diff --git a/pkg/provider/kubernetes/provider.go b/pkg/provider/kubernetes/provider.go index b9c508f7c1f..4308740f2b0 100644 --- a/pkg/provider/kubernetes/provider.go +++ b/pkg/provider/kubernetes/provider.go @@ -166,6 +166,6 @@ func isReferentSpec(prov *esv1beta1.KubernetesProvider) bool { return false } -func (p *Provider) Close(ctx context.Context) error { +func (p *Provider) Close(_ context.Context) error { return nil } diff --git a/pkg/provider/kubernetes/validate_test.go b/pkg/provider/kubernetes/validate_test.go index e55a7c5111a..c38078b4254 100644 --- a/pkg/provider/kubernetes/validate_test.go +++ b/pkg/provider/kubernetes/validate_test.go @@ -31,7 +31,7 @@ type fakeReviewClient struct { authReview *authv1.SelfSubjectRulesReview } -func (fk fakeReviewClient) Create(ctx context.Context, selfSubjectAccessReview *authv1.SelfSubjectRulesReview, opts metav1.CreateOptions) (*authv1.SelfSubjectRulesReview, error) { +func (fk fakeReviewClient) Create(_ context.Context, _ *authv1.SelfSubjectRulesReview, _ metav1.CreateOptions) (*authv1.SelfSubjectRulesReview, error) { if fk.authReview == nil { return nil, errors.New(errSomethingWentWrong) } diff --git a/pkg/provider/onepassword/fake/fake.go b/pkg/provider/onepassword/fake/fake.go index d62c85477c6..398b2f028ea 100644 --- a/pkg/provider/onepassword/fake/fake.go +++ b/pkg/provider/onepassword/fake/fake.go @@ -44,12 +44,12 @@ func (mockClient *OnePasswordMockClient) GetVaults() ([]onepassword.Vault, error } // GetVault unused fake. -func (mockClient *OnePasswordMockClient) GetVault(uuid string) (*onepassword.Vault, error) { +func (mockClient *OnePasswordMockClient) GetVault(_ string) (*onepassword.Vault, error) { return &onepassword.Vault{}, nil } // GetVaultByUUID unused fake. -func (mockClient *OnePasswordMockClient) GetVaultByUUID(uuid string) (*onepassword.Vault, error) { +func (mockClient *OnePasswordMockClient) GetVaultByUUID(_ string) (*onepassword.Vault, error) { return &onepassword.Vault{}, nil } @@ -100,7 +100,7 @@ func (mockClient *OnePasswordMockClient) GetItemByUUID(itemUUID, vaultUUID strin } // GetItemByTitle unused fake. -func (mockClient *OnePasswordMockClient) GetItemByTitle(title, vaultUUID string) (*onepassword.Item, error) { +func (mockClient *OnePasswordMockClient) GetItemByTitle(_, _ string) (*onepassword.Item, error) { return &onepassword.Item{}, nil } @@ -117,37 +117,37 @@ func (mockClient *OnePasswordMockClient) GetItemsByTitle(itemUUID, vaultUUID str } // CreateItem unused fake. -func (mockClient *OnePasswordMockClient) CreateItem(item *onepassword.Item, vaultUUID string) (*onepassword.Item, error) { +func (mockClient *OnePasswordMockClient) CreateItem(_ *onepassword.Item, _ string) (*onepassword.Item, error) { return &onepassword.Item{}, nil } // UpdateItem unused fake. -func (mockClient *OnePasswordMockClient) UpdateItem(item *onepassword.Item, vaultUUID string) (*onepassword.Item, error) { +func (mockClient *OnePasswordMockClient) UpdateItem(_ *onepassword.Item, _ string) (*onepassword.Item, error) { return &onepassword.Item{}, nil } // DeleteItem unused fake. -func (mockClient *OnePasswordMockClient) DeleteItem(item *onepassword.Item, vaultUUID string) error { +func (mockClient *OnePasswordMockClient) DeleteItem(_ *onepassword.Item, _ string) error { return nil } // DeleteItemByID unused fake. -func (mockClient *OnePasswordMockClient) DeleteItemByID(itemUUID, vaultQuery string) error { +func (mockClient *OnePasswordMockClient) DeleteItemByID(_, _ string) error { return nil } // DeleteItemByTitle unused fake. -func (mockClient *OnePasswordMockClient) DeleteItemByTitle(title, vaultQuery string) error { +func (mockClient *OnePasswordMockClient) DeleteItemByTitle(_, _ string) error { return nil } // GetFiles unused fake. -func (mockClient *OnePasswordMockClient) GetFiles(itemQuery, vaultQuery string) ([]onepassword.File, error) { +func (mockClient *OnePasswordMockClient) GetFiles(_, _ string) ([]onepassword.File, error) { return []onepassword.File{}, nil } // GetFile unused fake. -func (mockClient *OnePasswordMockClient) GetFile(fileUUID, itemUUID, vaultUUID string) (*onepassword.File, error) { +func (mockClient *OnePasswordMockClient) GetFile(_, _, _ string) (*onepassword.File, error) { return &onepassword.File{}, nil } @@ -162,27 +162,27 @@ func (mockClient *OnePasswordMockClient) GetFileContent(file *onepassword.File) } // DownloadFile unused fake. -func (mockClient *OnePasswordMockClient) DownloadFile(file *onepassword.File, targetDirectory string, overwrite bool) (string, error) { +func (mockClient *OnePasswordMockClient) DownloadFile(_ *onepassword.File, _ string, _ bool) (string, error) { return "", nil } // LoadStructFromItemByUUID unused fake. -func (mockClient *OnePasswordMockClient) LoadStructFromItemByUUID(config interface{}, itemUUID, vaultQuery string) error { +func (mockClient *OnePasswordMockClient) LoadStructFromItemByUUID(_ interface{}, _, _ string) error { return nil } // LoadStructFromItemByTitle unused fake. -func (mockClient *OnePasswordMockClient) LoadStructFromItemByTitle(config interface{}, itemTitle, vaultQuery string) error { +func (mockClient *OnePasswordMockClient) LoadStructFromItemByTitle(_ interface{}, _, _ string) error { return nil } // LoadStructFromItem unused fake. -func (mockClient *OnePasswordMockClient) LoadStructFromItem(config interface{}, itemQuery, vaultQuery string) error { +func (mockClient *OnePasswordMockClient) LoadStructFromItem(_ interface{}, _, _ string) error { return nil } // LoadStructunused fake. -func (mockClient *OnePasswordMockClient) LoadStruct(config interface{}) error { +func (mockClient *OnePasswordMockClient) LoadStruct(_ interface{}) error { return nil } diff --git a/pkg/provider/onepassword/onepassword.go b/pkg/provider/onepassword/onepassword.go index a9a67167612..0c407c70134 100644 --- a/pkg/provider/onepassword/onepassword.go +++ b/pkg/provider/onepassword/onepassword.go @@ -152,17 +152,17 @@ func validateStore(store esv1beta1.GenericStore) error { return nil } -func (provider *ProviderOnePassword) DeleteSecret(ctx context.Context, remoteRef esv1beta1.PushRemoteRef) error { +func (provider *ProviderOnePassword) DeleteSecret(_ context.Context, _ esv1beta1.PushRemoteRef) error { return fmt.Errorf("not implemented") } // Not Implemented PushSecret. -func (provider *ProviderOnePassword) PushSecret(ctx context.Context, value []byte, remoteRef esv1beta1.PushRemoteRef) error { +func (provider *ProviderOnePassword) PushSecret(_ context.Context, _ []byte, _ esv1beta1.PushRemoteRef) error { return fmt.Errorf("not implemented") } // GetSecret returns a single secret from the provider. -func (provider *ProviderOnePassword) GetSecret(ctx context.Context, ref esv1beta1.ExternalSecretDataRemoteRef) ([]byte, error) { +func (provider *ProviderOnePassword) GetSecret(_ context.Context, ref esv1beta1.ExternalSecretDataRemoteRef) ([]byte, error) { if ref.Version != "" { return nil, fmt.Errorf(errVersionNotImplemented) } @@ -196,7 +196,7 @@ func (provider *ProviderOnePassword) Validate() (esv1beta1.ValidationResult, err } // GetSecretMap returns multiple k/v pairs from the provider, for dataFrom.extract. -func (provider *ProviderOnePassword) GetSecretMap(ctx context.Context, ref esv1beta1.ExternalSecretDataRemoteRef) (map[string][]byte, error) { +func (provider *ProviderOnePassword) GetSecretMap(_ context.Context, ref esv1beta1.ExternalSecretDataRemoteRef) (map[string][]byte, error) { if ref.Version != "" { return nil, fmt.Errorf(errVersionNotImplemented) } @@ -216,7 +216,7 @@ func (provider *ProviderOnePassword) GetSecretMap(ctx context.Context, ref esv1b } // GetAllSecrets syncs multiple 1Password Items into a single Kubernetes Secret, for dataFrom.find. -func (provider *ProviderOnePassword) GetAllSecrets(ctx context.Context, ref esv1beta1.ExternalSecretFind) (map[string][]byte, error) { +func (provider *ProviderOnePassword) GetAllSecrets(_ context.Context, ref esv1beta1.ExternalSecretFind) (map[string][]byte, error) { if ref.Tags != nil { return nil, fmt.Errorf(errTagsNotImplemented) } @@ -239,7 +239,7 @@ func (provider *ProviderOnePassword) GetAllSecrets(ctx context.Context, ref esv1 } // Close closes the client connection. -func (provider *ProviderOnePassword) Close(ctx context.Context) error { +func (provider *ProviderOnePassword) Close(_ context.Context) error { return nil } diff --git a/pkg/provider/oracle/fake/fake.go b/pkg/provider/oracle/fake/fake.go index 1090f4d7648..2dc02ba82d8 100644 --- a/pkg/provider/oracle/fake/fake.go +++ b/pkg/provider/oracle/fake/fake.go @@ -27,7 +27,7 @@ func (mc *OracleMockClient) GetSecretBundleByName(ctx context.Context, request s return mc.getSecret(ctx, request) } -func (mc *OracleMockClient) WithValue(input secrets.GetSecretBundleByNameRequest, output secrets.GetSecretBundleByNameResponse, err error) { +func (mc *OracleMockClient) WithValue(_ secrets.GetSecretBundleByNameRequest, output secrets.GetSecretBundleByNameResponse, err error) { if mc != nil { mc.getSecret = func(ctx context.Context, paramReq secrets.GetSecretBundleByNameRequest) (secrets.GetSecretBundleByNameResponse, error) { return output, err diff --git a/pkg/provider/oracle/oracle.go b/pkg/provider/oracle/oracle.go index da798526d51..0a1ef3d02e4 100644 --- a/pkg/provider/oracle/oracle.go +++ b/pkg/provider/oracle/oracle.go @@ -74,16 +74,16 @@ type KmsVCInterface interface { } // Not Implemented PushSecret. -func (vms *VaultManagementService) PushSecret(ctx context.Context, value []byte, remoteRef esv1beta1.PushRemoteRef) error { +func (vms *VaultManagementService) PushSecret(_ context.Context, _ []byte, _ esv1beta1.PushRemoteRef) error { return fmt.Errorf("not implemented") } -func (vms *VaultManagementService) DeleteSecret(ctx context.Context, remoteRef esv1beta1.PushRemoteRef) error { +func (vms *VaultManagementService) DeleteSecret(_ context.Context, _ esv1beta1.PushRemoteRef) error { return fmt.Errorf("not implemented") } // Empty GetAllSecrets. -func (vms *VaultManagementService) GetAllSecrets(ctx context.Context, ref esv1beta1.ExternalSecretFind) (map[string][]byte, error) { +func (vms *VaultManagementService) GetAllSecrets(_ context.Context, _ esv1beta1.ExternalSecretFind) (map[string][]byte, error) { // TO be implemented return nil, fmt.Errorf("GetAllSecrets not implemented") } @@ -249,7 +249,7 @@ func getUserAuthConfigurationProvider(ctx context.Context, kube kclient.Client, return common.NewRawConfigurationProvider(store.Auth.Tenancy, store.Auth.User, region, fingerprint, privateKey, nil), nil } -func (vms *VaultManagementService) Close(ctx context.Context) error { +func (vms *VaultManagementService) Close(_ context.Context) error { return nil } diff --git a/pkg/provider/senhasegura/dsm/dsm.go b/pkg/provider/senhasegura/dsm/dsm.go index a3f5039f1e8..34ada029ca0 100644 --- a/pkg/provider/senhasegura/dsm/dsm.go +++ b/pkg/provider/senhasegura/dsm/dsm.go @@ -90,19 +90,19 @@ func New(isoSession *senhaseguraAuth.SenhaseguraIsoSession) (*DSM, error) { }, nil } -func (dsm *DSM) DeleteSecret(ctx context.Context, remoteRef esv1beta1.PushRemoteRef) error { +func (dsm *DSM) DeleteSecret(_ context.Context, _ esv1beta1.PushRemoteRef) error { return fmt.Errorf("not implemented") } // Not Implemented PushSecret. -func (dsm *DSM) PushSecret(ctx context.Context, value []byte, remoteRef esv1beta1.PushRemoteRef) error { +func (dsm *DSM) PushSecret(_ context.Context, _ []byte, _ esv1beta1.PushRemoteRef) error { return fmt.Errorf("not implemented") } /* GetSecret implements ESO interface and get a single secret from senhasegura provider with DSM service. */ -func (dsm *DSM) GetSecret(ctx context.Context, ref esv1beta1.ExternalSecretDataRemoteRef) (resp []byte, err error) { +func (dsm *DSM) GetSecret(_ context.Context, ref esv1beta1.ExternalSecretDataRemoteRef) (resp []byte, err error) { appSecrets, err := dsm.FetchSecrets() if err != nil { return []byte(""), err @@ -137,7 +137,7 @@ func (dsm *DSM) GetSecret(ctx context.Context, ref esv1beta1.ExternalSecretDataR /* GetSecretMap implements ESO interface and returns miltiple k/v pairs from senhasegura provider with DSM service. */ -func (dsm *DSM) GetSecretMap(ctx context.Context, ref esv1beta1.ExternalSecretDataRemoteRef) (secretData map[string][]byte, err error) { +func (dsm *DSM) GetSecretMap(_ context.Context, ref esv1beta1.ExternalSecretDataRemoteRef) (secretData map[string][]byte, err error) { secretData = make(map[string][]byte) appSecrets, err := dsm.FetchSecrets() if err != nil { @@ -162,7 +162,7 @@ GetAllSecrets implements ESO interface and returns multiple secrets from senhase TODO: GetAllSecrets functionality is to get secrets from either regexp-matching against the names or via metadata label matching. https://github.com/external-secrets/external-secrets/pull/830#discussion_r858657107 */ -func (dsm *DSM) GetAllSecrets(ctx context.Context, ref esv1beta1.ExternalSecretFind) (secretData map[string][]byte, err error) { +func (dsm *DSM) GetAllSecrets(_ context.Context, _ esv1beta1.ExternalSecretFind) (secretData map[string][]byte, err error) { return nil, fmt.Errorf("GetAllSecrets not implemented yet") } @@ -219,7 +219,7 @@ func (dsm *DSM) FetchSecrets() (respObj IsoDappResponse, err error) { /* Close implements ESO interface and do nothing in senhasegura. */ -func (dsm *DSM) Close(ctx context.Context) error { +func (dsm *DSM) Close(_ context.Context) error { return nil } diff --git a/pkg/provider/testing/fake/fake.go b/pkg/provider/testing/fake/fake.go index aaced1457fd..d6ba22bbaeb 100644 --- a/pkg/provider/testing/fake/fake.go +++ b/pkg/provider/testing/fake/fake.go @@ -79,7 +79,7 @@ func (v *Client) GetAllSecrets(ctx context.Context, ref esv1beta1.ExternalSecret } // Not Implemented PushSecret. -func (v *Client) PushSecret(ctx context.Context, value []byte, remoteRef esv1beta1.PushRemoteRef) error { +func (v *Client) PushSecret(_ context.Context, value []byte, remoteRef esv1beta1.PushRemoteRef) error { v.SetSecretArgs[remoteRef.GetRemoteKey()] = SetSecretCallArgs{ Value: value, RemoteRef: remoteRef, @@ -87,7 +87,7 @@ func (v *Client) PushSecret(ctx context.Context, value []byte, remoteRef esv1bet return v.SetSecretFn() } -func (v *Client) DeleteSecret(ctx context.Context, remoteRef esv1beta1.PushRemoteRef) error { +func (v *Client) DeleteSecret(_ context.Context, _ esv1beta1.PushRemoteRef) error { return v.DeleteSecretFn() } @@ -109,7 +109,7 @@ func (v *Client) GetSecretMap(ctx context.Context, ref esv1beta1.ExternalSecretD return v.GetSecretMapFn(ctx, ref) } -func (v *Client) Close(ctx context.Context) error { +func (v *Client) Close(_ context.Context) error { return nil } @@ -117,7 +117,7 @@ func (v *Client) Validate() (esv1beta1.ValidationResult, error) { return esv1beta1.ValidationResultReady, nil } -func (v *Client) ValidateStore(store esv1beta1.GenericStore) error { +func (v *Client) ValidateStore(_ esv1beta1.GenericStore) error { return nil } diff --git a/pkg/provider/util/fake/token_fetcher.go b/pkg/provider/util/fake/token_fetcher.go index cc13e18a3c1..388d356f620 100644 --- a/pkg/provider/util/fake/token_fetcher.go +++ b/pkg/provider/util/fake/token_fetcher.go @@ -43,7 +43,7 @@ func (m *MockK8sV1) WithError(err error) *MockK8sV1 { return m } -func (m *MockK8sV1) ServiceAccounts(namespace string) k8sv1.ServiceAccountInterface { +func (m *MockK8sV1) ServiceAccounts(_ string) k8sv1.ServiceAccountInterface { return &MockK8sV1SA{v1mock: m} } @@ -54,10 +54,10 @@ type MockK8sV1SA struct { } func (ma *MockK8sV1SA) CreateToken( - ctx context.Context, - serviceAccountName string, - tokenRequest *authv1.TokenRequest, - opts metav1.CreateOptions, + _ context.Context, + _ string, + _ *authv1.TokenRequest, + _ metav1.CreateOptions, ) (*authv1.TokenRequest, error) { if ma.v1mock.err != nil { return nil, ma.v1mock.err diff --git a/pkg/provider/vault/fake/vault.go b/pkg/provider/vault/fake/vault.go index e4709430ab6..3a1722a892a 100644 --- a/pkg/provider/vault/fake/vault.go +++ b/pkg/provider/vault/fake/vault.go @@ -238,7 +238,7 @@ func (c *VaultClient) AddHeader(key, value string) { c.MockAddHeader(key, value) } -func ClientWithLoginMock(c *vault.Config) (util.Client, error) { +func ClientWithLoginMock(_ *vault.Config) (util.Client, error) { cl := VaultClient{ MockAuthToken: NewAuthTokenFn(), MockSetToken: NewSetTokenFn(), diff --git a/pkg/provider/vault/vault_test.go b/pkg/provider/vault/vault_test.go index c0a85675d17..3d25f566015 100644 --- a/pkg/provider/vault/vault_test.go +++ b/pkg/provider/vault/vault_test.go @@ -495,7 +495,7 @@ MIIFkTCCA3mgAwIBAgIUBEUg3m/WqAsWHG4Q/II3IePFfuowDQYJKoZIhvcNAQELBQAwWDELMAkGA1UE } } -func vaultTest(t *testing.T, name string, tc testCase) { +func vaultTest(t *testing.T, _ string, tc testCase) { conn := &Connector{ NewVaultClient: tc.args.newClientFunc, } diff --git a/pkg/provider/webhook/webhook.go b/pkg/provider/webhook/webhook.go index 8d54c34d72c..150502f4429 100644 --- a/pkg/provider/webhook/webhook.go +++ b/pkg/provider/webhook/webhook.go @@ -66,7 +66,7 @@ func (p *Provider) Capabilities() esv1beta1.SecretStoreCapabilities { return esv1beta1.SecretStoreReadOnly } -func (p *Provider) NewClient(ctx context.Context, store esv1beta1.GenericStore, kube client.Client, namespace string) (esv1beta1.SecretsClient, error) { +func (p *Provider) NewClient(_ context.Context, store esv1beta1.GenericStore, kube client.Client, namespace string) (esv1beta1.SecretsClient, error) { whClient := &WebHook{ kube: kube, store: store, @@ -86,7 +86,7 @@ func (p *Provider) NewClient(ctx context.Context, store esv1beta1.GenericStore, return whClient, nil } -func (p *Provider) ValidateStore(store esv1beta1.GenericStore) error { +func (p *Provider) ValidateStore(_ esv1beta1.GenericStore) error { return nil } @@ -116,17 +116,17 @@ func (w *WebHook) getStoreSecret(ctx context.Context, ref esmeta.SecretKeySelect return secret, nil } -func (w *WebHook) DeleteSecret(ctx context.Context, remoteRef esv1beta1.PushRemoteRef) error { +func (w *WebHook) DeleteSecret(_ context.Context, _ esv1beta1.PushRemoteRef) error { return fmt.Errorf("not implemented") } // Not Implemented PushSecret. -func (w *WebHook) PushSecret(ctx context.Context, value []byte, remoteRef esv1beta1.PushRemoteRef) error { +func (w *WebHook) PushSecret(_ context.Context, _ []byte, _ esv1beta1.PushRemoteRef) error { return fmt.Errorf("not implemented") } // Empty GetAllSecrets. -func (w *WebHook) GetAllSecrets(ctx context.Context, ref esv1beta1.ExternalSecretFind) (map[string][]byte, error) { +func (w *WebHook) GetAllSecrets(_ context.Context, _ esv1beta1.ExternalSecretFind) (map[string][]byte, error) { // TO be implemented return nil, fmt.Errorf("GetAllSecrets not implemented") } @@ -423,7 +423,7 @@ func (w *WebHook) getCertFromConfigMap(provider *esv1beta1.WebhookProvider) ([]b return []byte(val), nil } -func (w *WebHook) Close(ctx context.Context) error { +func (w *WebHook) Close(_ context.Context) error { return nil } diff --git a/pkg/provider/yandex/certificatemanager/client/fakeclient.go b/pkg/provider/yandex/certificatemanager/client/fakeclient.go index e85e9538401..3c397c4fb5d 100644 --- a/pkg/provider/yandex/certificatemanager/client/fakeclient.go +++ b/pkg/provider/yandex/certificatemanager/client/fakeclient.go @@ -37,7 +37,7 @@ func NewFakeCertificateManagerClient(fakeCertificateManagerServer *FakeCertifica return &fakeCertificateManagerClient{fakeCertificateManagerServer} } -func (c *fakeCertificateManagerClient) GetCertificateContent(ctx context.Context, iamToken, certificateID, versionID string) (*api.GetCertificateContentResponse, error) { +func (c *fakeCertificateManagerClient) GetCertificateContent(_ context.Context, iamToken, certificateID, versionID string) (*api.GetCertificateContentResponse, error) { return c.fakeCertificateManagerServer.getCertificateContent(iamToken, certificateID, versionID) } diff --git a/pkg/provider/yandex/certificatemanager/client/grpcclient.go b/pkg/provider/yandex/certificatemanager/client/grpcclient.go index 760aca25807..da70c302299 100644 --- a/pkg/provider/yandex/certificatemanager/client/grpcclient.go +++ b/pkg/provider/yandex/certificatemanager/client/grpcclient.go @@ -42,7 +42,7 @@ func NewGrpcCertificateManagerClient(ctx context.Context, apiEndpoint string, au return &grpcCertificateManagerClient{api.NewCertificateContentServiceClient(conn)}, nil } -func (c *grpcCertificateManagerClient) GetCertificateContent(ctx context.Context, iamToken, certificateID, versionID string) (*api.GetCertificateContentResponse, error) { +func (c *grpcCertificateManagerClient) GetCertificateContent(ctx context.Context, iamToken, certificateID, _ string) (*api.GetCertificateContentResponse, error) { response, err := c.certificateContentServiceClient.Get( ctx, &api.GetCertificateContentRequest{ diff --git a/pkg/provider/yandex/common/sdk.go b/pkg/provider/yandex/common/sdk.go index 837f90f82aa..dec8317587f 100644 --- a/pkg/provider/yandex/common/sdk.go +++ b/pkg/provider/yandex/common/sdk.go @@ -129,7 +129,7 @@ type PerRPCCredentials struct { IamToken string } -func (t PerRPCCredentials) GetRequestMetadata(ctx context.Context, in ...string) (map[string]string, error) { +func (t PerRPCCredentials) GetRequestMetadata(_ context.Context, _ ...string) (map[string]string, error) { return map[string]string{"Authorization": "Bearer " + t.IamToken}, nil } diff --git a/pkg/provider/yandex/common/secretsclient.go b/pkg/provider/yandex/common/secretsclient.go index 9bc6d3b8e24..ff5370ed54b 100644 --- a/pkg/provider/yandex/common/secretsclient.go +++ b/pkg/provider/yandex/common/secretsclient.go @@ -34,11 +34,11 @@ func (c *yandexCloudSecretsClient) GetSecret(ctx context.Context, ref esv1beta1. return c.secretGetter.GetSecret(ctx, c.iamToken, ref.Key, ref.Version, ref.Property) } -func (c *yandexCloudSecretsClient) DeleteSecret(ctx context.Context, remoteRef esv1beta1.PushRemoteRef) error { +func (c *yandexCloudSecretsClient) DeleteSecret(_ context.Context, _ esv1beta1.PushRemoteRef) error { return fmt.Errorf("not implemented") } -func (c *yandexCloudSecretsClient) PushSecret(ctx context.Context, value []byte, remoteRef esv1beta1.PushRemoteRef) error { +func (c *yandexCloudSecretsClient) PushSecret(_ context.Context, _ []byte, _ esv1beta1.PushRemoteRef) error { return fmt.Errorf("not implemented") } @@ -50,11 +50,11 @@ func (c *yandexCloudSecretsClient) GetSecretMap(ctx context.Context, ref esv1bet return c.secretGetter.GetSecretMap(ctx, c.iamToken, ref.Key, ref.Version) } -func (c *yandexCloudSecretsClient) GetAllSecrets(ctx context.Context, ref esv1beta1.ExternalSecretFind) (map[string][]byte, error) { +func (c *yandexCloudSecretsClient) GetAllSecrets(_ context.Context, _ esv1beta1.ExternalSecretFind) (map[string][]byte, error) { // TO be implemented return nil, fmt.Errorf("GetAllSecrets not supported") } -func (c *yandexCloudSecretsClient) Close(ctx context.Context) error { +func (c *yandexCloudSecretsClient) Close(_ context.Context) error { return nil } diff --git a/pkg/provider/yandex/lockbox/client/fakeclient.go b/pkg/provider/yandex/lockbox/client/fakeclient.go index 6c9fcb9545c..d7305e2cc8a 100644 --- a/pkg/provider/yandex/lockbox/client/fakeclient.go +++ b/pkg/provider/yandex/lockbox/client/fakeclient.go @@ -37,7 +37,7 @@ func NewFakeLockboxClient(fakeLockboxServer *FakeLockboxServer) LockboxClient { return &fakeLockboxClient{fakeLockboxServer} } -func (c *fakeLockboxClient) GetPayloadEntries(ctx context.Context, iamToken, secretID, versionID string) ([]*api.Payload_Entry, error) { +func (c *fakeLockboxClient) GetPayloadEntries(_ context.Context, iamToken, secretID, versionID string) ([]*api.Payload_Entry, error) { return c.fakeLockboxServer.getEntries(iamToken, secretID, versionID) } diff --git a/pkg/template/v1/template.go b/pkg/template/v1/template.go index de87e9debeb..849fd6c049a 100644 --- a/pkg/template/v1/template.go +++ b/pkg/template/v1/template.go @@ -72,7 +72,7 @@ const ( ) // Execute renders the secret data as template. If an error occurs processing is stopped immediately. -func Execute(tpl, data map[string][]byte, scope esapi.TemplateScope, target esapi.TemplateTarget, secret *corev1.Secret) error { +func Execute(tpl, data map[string][]byte, _ esapi.TemplateScope, _ esapi.TemplateTarget, secret *corev1.Secret) error { if tpl == nil { return nil }