Skip to content

Commit

Permalink
fix lints and bump golangci-lint to 1.55.x
Browse files Browse the repository at this point in the history
Signed-off-by: cpanato <ctadeu@gmail.com>
  • Loading branch information
cpanato committed Oct 27, 2023
1 parent 6f40158 commit cf3ff59
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -178,5 +178,5 @@ jobs:
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.54
version: v1.55
args: --timeout=5m
2 changes: 1 addition & 1 deletion internal/pkg/cosign/tsa/mock/mock_tsa_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,5 @@ func (c *TSAClient) GetTimestampResponse(tsq []byte) ([]byte, error) {
tsStruct.Time = c.Time
}

return tsStruct.CreateResponse(c.CertChain[0], c.Signer)
return tsStruct.CreateResponseWithOpts(c.CertChain[0], c.Signer, hashAlg)
}
5 changes: 2 additions & 3 deletions pkg/cosign/kubernetes/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ import (
"os"
"strings"

"k8s.io/utils/pointer"

v1 "k8s.io/api/core/v1"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/ptr"

"github.com/sigstore/cosign/v2/pkg/cosign"
)
Expand Down Expand Up @@ -120,7 +119,7 @@ func secret(keys *cosign.KeysBytes, namespace, name string, data map[string][]by
return &v1.Secret{
ObjectMeta: obj,
Data: data,
Immutable: pointer.Bool(true),
Immutable: ptr.To[bool](true),
}
}

Expand Down
5 changes: 2 additions & 3 deletions pkg/cosign/kubernetes/secret_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ import (
"reflect"
"testing"

"k8s.io/utils/pointer"

v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/ptr"

"github.com/sigstore/cosign/v2/pkg/cosign"
)
Expand All @@ -43,7 +42,7 @@ func TestSecret(t *testing.T) {
"cosign.pub": []byte("public"),
"cosign.password": nil,
},
Immutable: pointer.Bool(true),
Immutable: ptr.To[bool](true),
}
actual := secret(keys, namespace, name, nil, true)
if !reflect.DeepEqual(actual, expect) {
Expand Down
18 changes: 12 additions & 6 deletions pkg/oci/mutate/mutate.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,16 @@ func (i *indexWrapper) SignedImage(h v1.Hash) (oci.SignedImage, error) {
return si, nil
}
}

if sb, ok := i.ogbase.(oci.SignedImageIndex); ok {
return sb.SignedImage(h)
} else if unsigned, err := i.Image(h); err != nil {
}

unsigned, err := i.Image(h)
if err != nil {
return nil, err
} else {
return signed.Image(unsigned), nil
}
return signed.Image(unsigned), nil
}

// SignedImageIndex implements oci.SignedImageIndex
Expand All @@ -118,13 +121,16 @@ func (i *indexWrapper) SignedImageIndex(h v1.Hash) (oci.SignedImageIndex, error)
return sii, nil
}
}

if sb, ok := i.ogbase.(oci.SignedImageIndex); ok {
return sb.SignedImageIndex(h)
} else if unsigned, err := i.ImageIndex(h); err != nil {
}

unsigned, err := i.ImageIndex(h)
if err != nil {
return nil, err
} else {
return signed.ImageIndex(unsigned), nil
}
return signed.ImageIndex(unsigned), nil
}

// AttachSignatureToEntity attaches the provided signature to the provided entity.
Expand Down

0 comments on commit cf3ff59

Please sign in to comment.