diff --git a/.golangci.yml b/.golangci.yml index 08b2f8809d..ec9d97791e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -28,6 +28,7 @@ linters: - misspell - noctx - nolintlint + - nosprintfhostport - paralleltest - staticcheck - structcheck diff --git a/pkg/autogen/rule.go b/pkg/autogen/rule.go index e886a64c65..4c4d1e322a 100644 --- a/pkg/autogen/rule.go +++ b/pkg/autogen/rule.go @@ -171,9 +171,7 @@ func generateRule(name string, rule *kyvernov1.Rule, tplKey, shift string, kinds } if len(rule.Validation.ForEachValidation) > 0 && rule.Validation.ForEachValidation != nil { newForeachValidate := make([]kyvernov1.ForEachValidation, len(rule.Validation.ForEachValidation)) - for i, foreach := range rule.Validation.ForEachValidation { - newForeachValidate[i] = foreach - } + copy(newForeachValidate, rule.Validation.ForEachValidation) rule.Validation = kyvernov1.Validation{ Message: variables.FindAndShiftReferences(logger, rule.Validation.Message, shift, "pattern"), ForEachValidation: newForeachValidate,