Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump golangci-lint to v1.52 #274

Merged
merged 3 commits into from
Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ executors:
- image: node:19-slim
golangci-lint:
docker:
- image: golangci/golangci-lint:v1.51-alpine
- image: golangci/golangci-lint:v1.52-alpine
golang-previous:
docker:
- image: golang:1.19
Expand Down
6 changes: 5 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,13 @@ linters:
- typecheck
- unconvert
- unparam
# - unused
- unused
- whitespace

linters-settings:
errorlint:
# Go 1.19 compatibility (https://github.com/sylabs/sif/issues/265).
errorf-multi: false

misspell:
locale: US
4 changes: 2 additions & 2 deletions pkg/integrity/clearsign.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func newClearsignEncoder(e *openpgp.Entity, timeFunc func() time.Time) *clearsig

// signMessage signs the message from r in clear-sign format, and writes the result to w. On
// success, the hash function is returned.
func (en *clearsignEncoder) signMessage(ctx context.Context, w io.Writer, r io.Reader) (crypto.Hash, error) {
func (en *clearsignEncoder) signMessage(_ context.Context, w io.Writer, r io.Reader) (crypto.Hash, error) {
plaintext, err := clearsign.Encode(w, en.e.PrivateKey, en.config)
if err != nil {
return 0, err
Expand All @@ -63,7 +63,7 @@ func newClearsignDecoder(kr openpgp.KeyRing) *clearsignDecoder {

// verifyMessage reads a message from r, verifies its signature, and returns the message contents.
// On success, the signing entity is set in vr.
func (de *clearsignDecoder) verifyMessage(ctx context.Context, r io.Reader, h crypto.Hash, vr *VerifyResult) ([]byte, error) { //nolint:lll
func (de *clearsignDecoder) verifyMessage(_ context.Context, r io.Reader, _ crypto.Hash, vr *VerifyResult) ([]byte, error) { //nolint:lll
data, err := io.ReadAll(r)
if err != nil {
return nil, err
Expand Down
4 changes: 1 addition & 3 deletions pkg/integrity/digest.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2020-2022, Sylabs Inc. All rights reserved.
// Copyright (c) 2020-2023, Sylabs Inc. All rights reserved.
// This software is licensed under a 3-clause BSD license. Please consult the LICENSE.md file
// distributed with the sources of this project regarding your rights to use or distribute this
// software.
Expand Down Expand Up @@ -117,7 +117,6 @@ func (d digest) MarshalJSON() ([]byte, error) {
func (d *digest) UnmarshalJSON(data []byte) error {
var s string
if err := json.Unmarshal(data, &s); err != nil {
//nolint:errorlint // Go 1.19 compatibility
return fmt.Errorf("%w: %v", errDigestMalformed, err)
}

Expand All @@ -130,7 +129,6 @@ func (d *digest) UnmarshalJSON(data []byte) error {

v, err := hex.DecodeString(value)
if err != nil {
//nolint:errorlint // Go 1.19 compatibility
return fmt.Errorf("%w: %v", errDigestMalformed, err)
}

Expand Down
3 changes: 1 addition & 2 deletions pkg/integrity/dsse.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ func (de *dsseDecoder) verifyMessage(ctx context.Context, r io.Reader, h crypto.

vr.aks, err = v.Verify(ctx, &e)
if err != nil {
//nolint:errorlint // Go 1.19 compatibility
return nil, fmt.Errorf("%w: %v", errDSSEVerifyEnvelopeFailed, err)
}

Expand Down Expand Up @@ -168,7 +167,7 @@ func (s *dsseSigner) Sign(ctx context.Context, data []byte) ([]byte, error) {
var errSignNotImplemented = errors.New("sign not implemented")

// Verify is not implemented, but required for the dsse.SignVerifier interface.
func (s *dsseSigner) Verify(ctx context.Context, data, sig []byte) error {
func (s *dsseSigner) Verify(_ context.Context, _, _ []byte) error {
return errSignNotImplemented
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/integrity/verify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ func (v mockVerifier) signatures() ([]sif.Descriptor, error) {
return v.sigs, v.sigsErr
}

func (v mockVerifier) verifySignature(ctx context.Context, sig sif.Descriptor, de decoder, vr *VerifyResult) error {
func (v mockVerifier) verifySignature(_ context.Context, _ sif.Descriptor, _ decoder, vr *VerifyResult) error {
vr.verified = v.verified
vr.e = v.e
return v.verifyErr
Expand Down
6 changes: 1 addition & 5 deletions pkg/sif/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,11 +451,7 @@ func (f *FileImage) isLast(d *rawDescriptor) bool {
func (f *FileImage) truncateAt(d *rawDescriptor) error {
start := d.Offset + d.Size - d.SizeWithPadding

if err := f.rw.Truncate(start); err != nil {
return err
}

return nil
return f.rw.Truncate(start)
}

// deleteOpts accumulates object deletion options.
Expand Down
4 changes: 2 additions & 2 deletions pkg/siftool/siftool.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2018-2022, Sylabs Inc. All rights reserved.
// Copyright (c) 2018-2023, Sylabs Inc. All rights reserved.
// Copyright (c) 2017, SingularityWare, LLC. All rights reserved.
// Copyright (c) 2017, Yannick Cote <[email protected]> All rights reserved.
// This software is licensed under a 3-clause BSD license. Please consult the
Expand All @@ -20,7 +20,7 @@ type command struct {
}

// initApp initializes the siftool app.
func (c *command) initApp(cmd *cobra.Command, args []string) error {
func (c *command) initApp(cmd *cobra.Command, _ []string) error {
app, err := siftool.New(
siftool.OptAppOutput(cmd.OutOrStdout()),
siftool.OptAppError(cmd.ErrOrStderr()),
Expand Down