diff --git a/.golangci.yaml b/.golangci.yaml index f3a60f895..dd7e39fe0 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -31,3 +31,13 @@ linters-settings: - standard - default - prefix(github.com/enterprise-contract/ec-cli) + +issues: + exclude-rules: + # Some function in acceptance, e.g. ImageReferenceInStubRegistry, take a string parameter which + # is used in call to a string format call, e.g. fmt.Sprintf(...). Golinter started complaining + # starting on version v1.60. Since these are acceptance tests, there isn't a lot of harm in + # allowing this. + - path: acceptance + linters: [govet] + text: "printf: non-constant format string in call" diff --git a/acceptance/kubernetes/kind/kind.go b/acceptance/kubernetes/kind/kind.go index ac4325077..54e233dc1 100644 --- a/acceptance/kubernetes/kind/kind.go +++ b/acceptance/kubernetes/kind/kind.go @@ -168,7 +168,7 @@ func Start(givenCtx context.Context) (ctx context.Context, kCluster types.Cluste logger.Errorf("Unable to determine a free port: %v", err) return } else { - kCluster.registryPort = int32(port) + kCluster.registryPort = int32(port) //nolint:gosec // G115 - ports shouldn't be larger than int32 } if err = kCluster.provider.Create(kCluster.name, diff --git a/internal/output/output_test.go b/internal/output/output_test.go index e24c7979f..0c3f52630 100644 --- a/internal/output/output_test.go +++ b/internal/output/output_test.go @@ -830,7 +830,7 @@ func TestSetImageAccessibleCheckFromError(t *testing.T) { func TestSetImageSignatureCheckFromError(t *testing.T) { noMatchingSignatures := cosign.ErrNoMatchingSignatures{} f := reflect.ValueOf(&noMatchingSignatures).Elem().Field(0) - f = reflect.NewAt(f.Type(), unsafe.Pointer(f.UnsafeAddr())).Elem() + f = reflect.NewAt(f.Type(), unsafe.Pointer(f.UnsafeAddr())).Elem() //nolint:gosec // G115 - seems to be a false positive f.Set(reflect.ValueOf(errors.New("kaboom!"))) cases := []struct { @@ -917,7 +917,7 @@ func TestSetImageSignatureCheckFromError(t *testing.T) { func TestSetAttestationSignatureCheckFromError(t *testing.T) { noMatchingAttestations := cosign.ErrNoMatchingAttestations{} f := reflect.ValueOf(&noMatchingAttestations).Elem().Field(0) - f = reflect.NewAt(f.Type(), unsafe.Pointer(f.UnsafeAddr())).Elem() + f = reflect.NewAt(f.Type(), unsafe.Pointer(f.UnsafeAddr())).Elem() //nolint:gosec // G115 - seems to be a false positive f.Set(reflect.ValueOf(errors.New("kaboom!"))) cases := []struct {