Skip to content

Commit

Permalink
Fix unparam violations
Browse files Browse the repository at this point in the history
  • Loading branch information
sagikazarmark authored and bonifaido committed Jan 28, 2020
1 parent d9e75f7 commit 95a1602
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ linters:
- lll

# TODO: fixme
- godox
- gochecknoglobals
- gochecknoinits
- unparam
- goconst
- gocognit
- errcheck
Expand Down
5 changes: 3 additions & 2 deletions cmd/bank-vaults/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ import (
"github.com/banzaicloud/bank-vaults/pkg/sdk/vault"
)

func vaultConfigForConfig(cfg *viper.Viper) (vault.Config, error) {

// TODO review this function's returned error
// nolint: unparam
func vaultConfigForConfig(_ *viper.Viper) (vault.Config, error) {
return vault.Config{
SecretShares: appConfig.GetInt(cfgSecretShares),
SecretThreshold: appConfig.GetInt(cfgSecretThreshold),
Expand Down
3 changes: 1 addition & 2 deletions cmd/vault-secrets-webhook/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ func configMapNeedsMutation(configMap *corev1.ConfigMap) bool {
return false
}

func mutateConfigMap(configMap *corev1.ConfigMap, vaultConfig internal.VaultConfig, ns string) error {

func mutateConfigMap(configMap *corev1.ConfigMap, vaultConfig internal.VaultConfig, _ string) error {
// do an early exit and don't construct the Vault client if not needed
if !configMapNeedsMutation(configMap) {
return nil
Expand Down
6 changes: 4 additions & 2 deletions cmd/vault-secrets-webhook/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ func secretNeedsMutation(secret *corev1.Secret) bool {
return false
}

func mutateSecret(secret *corev1.Secret, vaultConfig internal.VaultConfig, ns string) error {

func mutateSecret(secret *corev1.Secret, vaultConfig internal.VaultConfig, _ string) error {
// do an early exit and don't construct the Vault client if not needed
if !secretNeedsMutation(secret) {
return nil
Expand Down Expand Up @@ -139,6 +138,8 @@ func mutateSecretData(secret *corev1.Secret, sc map[string]string, vaultClient *
return nil
}

// TODO review this function's returned error
// nolint: unparam
func getDataFromVault(data map[string]string, vaultClient *vault.Client) (map[string]string, error) {
var vaultData = make(map[string]string)

Expand Down Expand Up @@ -170,6 +171,7 @@ func getDataFromVault(data map[string]string, vaultClient *vault.Client) (map[st
secret, err := vaultClient.RawClient().Logical().ReadWithData(path, map[string][]string{"version": {version}})
if err != nil {
logger.Errorf("Failed to read secret path: %s error: %s", path, err.Error())
// TODO return error?
}
if secret == nil {
logger.Errorf("Path not found path: %s", path)
Expand Down

0 comments on commit 95a1602

Please sign in to comment.