mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-17 23:26:14 +02:00
Fix various golangci-lint errors (#2059)
This commit is contained in:
@@ -56,7 +56,7 @@ func (c *Context) Exec(command string, args []interface{}, inputs ...string) (st
|
||||
for i, a := range args {
|
||||
switch a.(type) {
|
||||
case string:
|
||||
strArgs[i] = a.(string)
|
||||
strArgs[i] = fmt.Sprintf("%v", a)
|
||||
default:
|
||||
return "", fmt.Errorf("unexpected type of arg \"%s\" in args %v at index %d", reflect.TypeOf(a), args, i)
|
||||
}
|
||||
|
||||
@@ -3,10 +3,11 @@ package tmpl
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
)
|
||||
|
||||
func TestReadFile(t *testing.T) {
|
||||
@@ -207,14 +208,15 @@ func TestRequired(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
got, err := Required(tt.args.warn, tt.args.val)
|
||||
if (err != nil) != tt.wantErr {
|
||||
t.Errorf("Required() error = %v, wantErr %v", err, tt.wantErr)
|
||||
testCase := tt
|
||||
t.Run(testCase.name, func(t *testing.T) {
|
||||
got, err := Required(testCase.args.warn, testCase.args.val)
|
||||
if (err != nil) != testCase.wantErr {
|
||||
t.Errorf("Required() error = %v, wantErr %v", err, testCase.wantErr)
|
||||
return
|
||||
}
|
||||
if !reflect.DeepEqual(got, tt.want) {
|
||||
t.Errorf("Required() got = %v, want %v", got, tt.want)
|
||||
if !reflect.DeepEqual(got, testCase.want) {
|
||||
t.Errorf("Required() got = %v, want %v", got, testCase.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package tmpl
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"github.com/roboll/helmfile/pkg/plugins"
|
||||
"github.com/variantdev/vals"
|
||||
"sync"
|
||||
)
|
||||
|
||||
//to generate mock run mockgen -source=expand_secret_ref.go -destination=expand_secrets_mock.go -package=tmpl
|
||||
@@ -26,12 +26,12 @@ func fetchSecretValue(path string) (string, error) {
|
||||
|
||||
rendered, ok := resultMap["key"]
|
||||
if !ok {
|
||||
return "", errors.New(fmt.Sprintf("unexpected error occurred, %v doesn't have 'key' key", resultMap))
|
||||
return "", fmt.Errorf("unexpected error occurred, %v doesn't have 'key' key", resultMap)
|
||||
}
|
||||
|
||||
result, ok := rendered.(string)
|
||||
if !ok {
|
||||
return "", errors.New(fmt.Sprintf("expected %v to be string", rendered))
|
||||
return "", fmt.Errorf("expected %v to be string", rendered)
|
||||
}
|
||||
|
||||
return result, nil
|
||||
|
||||
Reference in New Issue
Block a user