Skip to content

Commit

Permalink
Address new linter issues
Browse files Browse the repository at this point in the history
Signed-off-by: Luiz Carvalho <lucarval@redhat.com>
  • Loading branch information
lcarva committed Sep 3, 2024
1 parent 3576099 commit 025bbd9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
10 changes: 10 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion acceptance/kubernetes/kind/kind.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions internal/output/output_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 025bbd9

Please sign in to comment.