diff --git a/.golangci.yaml b/.golangci.yaml index 94033ac..8fc206c 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -12,6 +12,9 @@ linters: - gochecknoglobals # We like global variables - tagalign # Buggy linters-settings: + gosec: + excludes: + - 'G601' cyclop: max-complexity: 12 run: diff --git a/cmd/manager/main.go b/cmd/manager/main.go index a72205a..a58dd80 100644 --- a/cmd/manager/main.go +++ b/cmd/manager/main.go @@ -83,7 +83,7 @@ func RefreshWatchers(ctx context.Context, kubeClient client.Reader) error { watchers = []v1alpha1.Watcher{} - for idx, watcher := range watcherList.Items { + for _, watcher := range watcherList.Items { for _, secretKeySelector := range watcher.Spec.ValuesFrom.Secrets { var ( secret v1.Secret @@ -101,7 +101,7 @@ func RefreshWatchers(ctx context.Context, kubeClient client.Reader) error { return unmarshallErr } - if mergeErr := mergo.Merge(&watcherList.Items[idx], v1alpha1.Watcher{Spec: specFromSecret}, + if mergeErr := mergo.Merge(&watcher, v1alpha1.Watcher{Spec: specFromSecret}, mergo.WithOverride, mergo.WithAppendSlice); mergeErr != nil { return mergeErr }