ci: fix all linter errors found in golangci-lint

Fixing all the linter errors found in golang-ci
lint v1.46.2

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna
2022-06-01 15:47:19 +05:30
committed by mergify[bot]
parent 9e5cad173d
commit 1952a9b4b3
56 changed files with 348 additions and 195 deletions

View File

@ -199,8 +199,7 @@ func (kms *awsMetadataKMS) EncryptDEK(volumeID, plainDEK string) (string, error)
// base64 encode the encrypted DEK, so that storing it should not have
// issues
encryptedDEK :=
base64.StdEncoding.EncodeToString(result.CiphertextBlob)
encryptedDEK := base64.StdEncoding.EncodeToString(result.CiphertextBlob)
return encryptedDEK, nil
}

View File

@ -269,7 +269,8 @@ func RegisterProvider(provider Provider) bool {
func (kf *kmsProviderList) buildKMS(
tenant string,
config map[string]interface{},
secrets map[string]string) (EncryptionKMS, error) {
secrets map[string]string,
) (EncryptionKMS, error) {
providerName, err := getProvider(config)
if err != nil {
return nil, err

View File

@ -138,7 +138,8 @@ func initSecretsMetadataKMS(args ProviderInitArgs) (EncryptionKMS, error) {
// fetchEncryptionPassphrase fetches encryptionPassphrase from user provided secret.
func (kms secretsMetadataKMS) fetchEncryptionPassphrase(
config map[string]interface{},
defaultNamespace string) (string, error) {
defaultNamespace string,
) (string, error) {
var (
secretName string
secretNamespace string

View File

@ -302,6 +302,7 @@ func (vc *vaultConnection) Destroy() {
tmpFile, ok := vc.vaultConfig[api.EnvVaultCACert]
if ok {
// ignore error on failure to remove tmpfile (gosec complains)
//nolint:forcetypeassert // ignore error on failure to remove tmpfile
_ = os.Remove(tmpFile.(string))
}
}

View File

@ -120,6 +120,7 @@ func TestInitVaultTokensKMS(t *testing.T) {
// add tenant "bob"
bob := make(map[string]interface{})
bob["vaultAddress"] = "https://vault.bob.example.org"
//nolint:forcetypeassert // as its a test we dont need to check assertion here.
args.Config["tenants"].(map[string]interface{})["bob"] = bob
_, err = initVaultTokensKMS(args)