diff --git a/pkg/kyverno/test/command.go b/pkg/kyverno/test/command.go index 8841bfc266..06a23ff09e 100644 --- a/pkg/kyverno/test/command.go +++ b/pkg/kyverno/test/command.go @@ -245,10 +245,6 @@ func applyPoliciesFromPath(fs billy.Filesystem, policyBytes []byte, valuesFile s fmt.Printf("Error: failed to load resources\nCause: %s\n", err) os.Exit(1) } - if err != nil { - fmt.Printf("Error: failed to load resources\nCause: %s\n", err) - os.Exit(1) - } msgPolicies := "1 policy" if len(mutatedPolicies) > 1 { msgPolicies = fmt.Sprintf("%d policies", len(policies)) diff --git a/pkg/webhookconfig/common.go b/pkg/webhookconfig/common.go index 059c0db52b..0ec76c8958 100644 --- a/pkg/webhookconfig/common.go +++ b/pkg/webhookconfig/common.go @@ -92,7 +92,7 @@ func generateDebugMutatingWebhook(name, url string, caData []byte, validate bool }, SideEffects: &sideEffect, Rules: []admregapi.RuleWithOperations{ - admregapi.RuleWithOperations{ + { Operations: operationTypes, Rule: admregapi.Rule{ APIGroups: []string{ @@ -122,7 +122,7 @@ func generateDebugValidatingWebhook(name, url string, caData []byte, validate bo }, SideEffects: &sideEffect, Rules: []admregapi.RuleWithOperations{ - admregapi.RuleWithOperations{ + { Operations: operationTypes, Rule: admregapi.Rule{ APIGroups: []string{ @@ -195,7 +195,7 @@ func generateValidatingWebhook(name, servicePath string, caData []byte, validati }, SideEffects: &sideEffect, Rules: []admregapi.RuleWithOperations{ - admregapi.RuleWithOperations{ + { Operations: operationTypes, Rule: admregapi.Rule{ APIGroups: []string{ diff --git a/pkg/webhooks/generation.go b/pkg/webhooks/generation.go index cca4867c3a..e0c5f14a51 100644 --- a/pkg/webhooks/generation.go +++ b/pkg/webhooks/generation.go @@ -217,7 +217,7 @@ func stripNonPolicyFields(obj, newRes map[string]interface{}, logger logr.Logger keyInData := make([]string, 0) switch dataMap.(type) { case map[string]interface{}: - for k, _ := range dataMap.(map[string]interface{}) { + for k := range dataMap.(map[string]interface{}) { keyInData = append(keyInData, k) } } diff --git a/pkg/webhooks/generation_test.go b/pkg/webhooks/generation_test.go index 409c66b7d6..d306b9eac6 100644 --- a/pkg/webhooks/generation_test.go +++ b/pkg/webhooks/generation_test.go @@ -16,7 +16,7 @@ func Test_updateFeildsInSourceAndUpdatedResource(t *testing.T) { } testcases := []TestCase{ - TestCase{ + { obj: map[string]interface{}{ "apiVersion": "v1", "data": map[string]interface{}{ @@ -75,7 +75,7 @@ func Test_updateFeildsInSourceAndUpdatedResource(t *testing.T) { "metadata": map[string]interface{}{}, }, }, - TestCase{ + { obj: map[string]interface{}{ "apiVersion": "v1", "data": map[string]interface{}{ @@ -150,7 +150,7 @@ func Test_updateFeildsInSourceAndUpdatedResource(t *testing.T) { }, }, }, - TestCase{ + { obj: map[string]interface{}{ "apiVersion": "v1", "kind": "Pod",