diff --git a/Makefile b/Makefile index 7d2ea03213b..025af8204a8 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ GATEKEEPER_NAMESPACE ?= gatekeeper-system # When updating this, make sure to update the corresponding action in # workflow.yaml -GOLANGCI_LINT_VERSION := v1.57.1 +GOLANGCI_LINT_VERSION := v1.63.4 # Detects the location of the user golangci-lint cache. GOLANGCI_LINT_CACHE := $(shell pwd)/.tmp/golangci-lint diff --git a/pkg/controller/constraint/constraint_controller.go b/pkg/controller/constraint/constraint_controller.go index ed8c2cc0746..1df04f6d3b4 100644 --- a/pkg/controller/constraint/constraint_controller.go +++ b/pkg/controller/constraint/constraint_controller.go @@ -493,7 +493,7 @@ func (r *ReconcileConstraint) reportErrorOnConstraintStatus(ctx context.Context, status.Status.Errors = append(status.Status.Errors, constraintstatusv1beta1.Error{Message: fmt.Sprintf("%s: %s", message, err)}) if err2 := r.writer.Update(ctx, status); err2 != nil { log.Error(err2, message, "error", "could not update constraint status") - return errorpkg.Wrapf(err, fmt.Sprintf("%s, could not update constraint status: %s", message, err2)) + return errorpkg.Wrapf(err, "%s", fmt.Sprintf("%s, could not update constraint status: %s", message, err2)) } return err } diff --git a/pkg/controller/mutators/core/reconciler_test.go b/pkg/controller/mutators/core/reconciler_test.go index bcebe7acdf2..3fa219e3d4e 100644 --- a/pkg/controller/mutators/core/reconciler_test.go +++ b/pkg/controller/mutators/core/reconciler_test.go @@ -198,7 +198,7 @@ func (m *fakeMutatorObject) DeepCopyObject() runtime.Object { err := m.err if err != nil { - err = fmt.Errorf(err.Error()) + err = errors.New("%s", err.Error()) } return &fakeMutatorObject{ diff --git a/pkg/controller/pubsub/pubsub_config_controller.go b/pkg/controller/pubsub/pubsub_config_controller.go index c3708792edc..4b79e64f0d9 100644 --- a/pkg/controller/pubsub/pubsub_config_controller.go +++ b/pkg/controller/pubsub/pubsub_config_controller.go @@ -114,10 +114,10 @@ func (r *Reconciler) Reconcile(ctx context.Context, request reconcile.Request) ( } if len(cfg.Data) == 0 { - return reconcile.Result{}, fmt.Errorf(fmt.Sprintf("data missing in configmap %s, unable to configure respective pubsub", request.NamespacedName)) + return reconcile.Result{}, errors.New("%s", fmt.Sprintf("data missing in configmap %s, unable to configure respective pubsub", request.NamespacedName)) } if _, ok := cfg.Data["provider"]; !ok { - return reconcile.Result{}, fmt.Errorf(fmt.Sprintf("missing provider field in configmap %s, unable to configure respective pubsub", request.NamespacedName)) + return reconcile.Result{}, errors.New("%s", fmt.Sprintf("missing provider field in configmap %s, unable to configure respective pubsub", request.NamespacedName)) } var config interface{} err = json.Unmarshal([]byte(cfg.Data["config"]), &config) diff --git a/pkg/gator/verify/runner_test.go b/pkg/gator/verify/runner_test.go index 9dad0480753..25cdce6fb54 100644 --- a/pkg/gator/verify/runner_test.go +++ b/pkg/gator/verify/runner_test.go @@ -1258,7 +1258,7 @@ func TestRunner_Run(t *testing.T) { if diff := cmp.Diff(tc.want, got, cmpopts.EquateErrors(), cmpopts.EquateEmpty(), cmpopts.IgnoreFields(SuiteResult{}, "Runtime"), cmpopts.IgnoreFields(TestResult{}, "Runtime"), cmpopts.IgnoreFields(CaseResult{}, "Runtime"), ); diff != "" { - t.Errorf(diff) + t.Error("%s", diff) } }) } @@ -1633,7 +1633,7 @@ func TestRunner_RunCase(t *testing.T) { if diff := cmp.Diff(want, got, cmpopts.EquateErrors(), cmpopts.EquateEmpty(), cmpopts.IgnoreFields(SuiteResult{}, "Runtime"), cmpopts.IgnoreFields(TestResult{}, "Runtime"), cmpopts.IgnoreFields(CaseResult{}, "Runtime"), ); diff != "" { - t.Errorf(diff) + t.Error("%s", diff) } }) } diff --git a/pkg/mutation/schema/node_test.go b/pkg/mutation/schema/node_test.go index cbb6dd8666f..f0eaeb5b7a7 100644 --- a/pkg/mutation/schema/node_test.go +++ b/pkg/mutation/schema/node_test.go @@ -524,7 +524,7 @@ func TestNode_Remove(t *testing.T) { } gotConflictBefore := root.GetConflicts(pCheck.Nodes, Unknown) if diff := cmp.Diff(tc.wantConflictBefore, gotConflictBefore, cmpopts.EquateEmpty()); diff != "" { - t.Errorf(diff) + t.Error("%s", diff) } for _, toRemove := range tc.toRemove { @@ -537,7 +537,7 @@ func TestNode_Remove(t *testing.T) { gotConflictAfter := root.GetConflicts(pCheck.Nodes, Unknown) if diff := cmp.Diff(tc.wantConflictAfter, gotConflictAfter, cmpopts.EquateEmpty()); diff != "" { - t.Errorf(diff) + t.Error("%s", diff) } }) } diff --git a/pkg/mutation/system_errors_test.go b/pkg/mutation/system_errors_test.go index a541a00eb5f..a93c03462b4 100644 --- a/pkg/mutation/system_errors_test.go +++ b/pkg/mutation/system_errors_test.go @@ -2,7 +2,6 @@ package mutation import ( "errors" - "fmt" "testing" "github.com/open-policy-agent/gatekeeper/v3/pkg/mutation/path/parser" @@ -59,7 +58,7 @@ func (e errorMutator) HasDiff(types.Mutator) bool { } func (e errorMutator) DeepCopy() types.Mutator { - return errorMutator{err: fmt.Errorf(e.err.Error())} + return errorMutator{err: errors.New("%s", e.err.Error())} } func (e errorMutator) Value(_ types.MetadataGetter) (interface{}, error) {