Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
Signed-off-by: Sertac Ozercan <[email protected]>
  • Loading branch information
sozercan committed Jan 22, 2025
1 parent 9c8c75f commit a9f7538
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/constraint/constraint_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/mutators/core/reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Check failure on line 201 in pkg/controller/mutators/core/reconciler_test.go

View workflow job for this annotation

GitHub Actions / Unit test

too many arguments in call to errors.New
}

return &fakeMutatorObject{
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/pubsub/pubsub_config_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Check failure on line 117 in pkg/controller/pubsub/pubsub_config_controller.go

View workflow job for this annotation

GitHub Actions / Unit test

undefined: errors.New

Check failure on line 117 in pkg/controller/pubsub/pubsub_config_controller.go

View workflow job for this annotation

GitHub Actions / Unit test

undefined: errors.New

Check failure on line 117 in pkg/controller/pubsub/pubsub_config_controller.go

View workflow job for this annotation

GitHub Actions / Run govulncheck

undefined: errors.New
}
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))

Check failure on line 120 in pkg/controller/pubsub/pubsub_config_controller.go

View workflow job for this annotation

GitHub Actions / Unit test

undefined: errors.New

Check failure on line 120 in pkg/controller/pubsub/pubsub_config_controller.go

View workflow job for this annotation

GitHub Actions / Unit test

undefined: errors.New

Check failure on line 120 in pkg/controller/pubsub/pubsub_config_controller.go

View workflow job for this annotation

GitHub Actions / Run govulncheck

undefined: errors.New
}
var config interface{}
err = json.Unmarshal([]byte(cfg.Data["config"]), &config)
Expand Down
4 changes: 2 additions & 2 deletions pkg/gator/verify/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check failure on line 1261 in pkg/gator/verify/runner_test.go

View workflow job for this annotation

GitHub Actions / Unit test

(*testing.common).Error call has possible Printf formatting directive %s
}
})
}
Expand Down Expand Up @@ -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)

Check failure on line 1636 in pkg/gator/verify/runner_test.go

View workflow job for this annotation

GitHub Actions / Unit test

(*testing.common).Error call has possible Printf formatting directive %s
}
})
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/mutation/schema/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check failure on line 527 in pkg/mutation/schema/node_test.go

View workflow job for this annotation

GitHub Actions / Unit test

(*testing.common).Error call has possible Printf formatting directive %s
}

for _, toRemove := range tc.toRemove {
Expand All @@ -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)

Check failure on line 540 in pkg/mutation/schema/node_test.go

View workflow job for this annotation

GitHub Actions / Unit test

(*testing.common).Error call has possible Printf formatting directive %s
}
})
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/mutation/system_errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package mutation

import (
"errors"
"fmt"
"testing"

"github.com/open-policy-agent/gatekeeper/v3/pkg/mutation/path/parser"
Expand Down Expand Up @@ -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())}

Check failure on line 61 in pkg/mutation/system_errors_test.go

View workflow job for this annotation

GitHub Actions / Unit test

too many arguments in call to errors.New
}

func (e errorMutator) Value(_ types.MetadataGetter) (interface{}, error) {
Expand Down

0 comments on commit a9f7538

Please sign in to comment.