From 2826f62c85213e4d907977a114f2eb9d4cbe0690 Mon Sep 17 00:00:00 2001 From: Adam Hughes <9903835+tri-adam@users.noreply.github.com> Date: Mon, 21 Aug 2023 10:18:39 -0500 Subject: [PATCH 1/4] chore: bump module Go version to 1.20 Signed-off-by: Dave Dykstra <2129743+DrDaveD@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- .golangci.yml | 4 ---- go.mod | 2 +- pkg/integrity/digest.go | 4 ++-- pkg/integrity/dsse.go | 2 +- 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 04e6d7f..47b4343 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v1 with: - go-version: '1.20.x' + go-version: '1.21.x' - name: Check go.mod and go.sum are tidy run: | diff --git a/.golangci.yml b/.golangci.yml index bceae78..a1f8bd8 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -56,9 +56,5 @@ linters: - whitespace linters-settings: - errorlint: - # Go 1.19 compatibility (https://github.com/sylabs/sif/issues/265). - errorf-multi: false - misspell: locale: US diff --git a/go.mod b/go.mod index b4995b6..b93cfa7 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/apptainer/sif/v2 -go 1.19 +go 1.20 require ( github.com/ProtonMail/go-crypto v0.0.0-20230710112148-e01326fd72eb diff --git a/pkg/integrity/digest.go b/pkg/integrity/digest.go index 6d45e3b..6f1b257 100644 --- a/pkg/integrity/digest.go +++ b/pkg/integrity/digest.go @@ -121,7 +121,7 @@ func (d digest) MarshalJSON() ([]byte, error) { func (d *digest) UnmarshalJSON(data []byte) error { var s string if err := json.Unmarshal(data, &s); err != nil { - return fmt.Errorf("%w: %v", errDigestMalformed, err) + return fmt.Errorf("%w: %w", errDigestMalformed, err) } parts := strings.Split(s, ":") @@ -133,7 +133,7 @@ func (d *digest) UnmarshalJSON(data []byte) error { v, err := hex.DecodeString(value) if err != nil { - return fmt.Errorf("%w: %v", errDigestMalformed, err) + return fmt.Errorf("%w: %w", errDigestMalformed, err) } for h, n := range supportedDigestAlgorithms { diff --git a/pkg/integrity/dsse.go b/pkg/integrity/dsse.go index 6364eb9..0c4fdbb 100644 --- a/pkg/integrity/dsse.go +++ b/pkg/integrity/dsse.go @@ -129,7 +129,7 @@ func (de *dsseDecoder) verifyMessage(ctx context.Context, r io.Reader, h crypto. vr.aks, err = v.Verify(ctx, &e) if err != nil { - return nil, fmt.Errorf("%w: %v", errDSSEVerifyEnvelopeFailed, err) + return nil, fmt.Errorf("%w: %w", errDSSEVerifyEnvelopeFailed, err) } if e.PayloadType != de.payloadType { From cfcbf8d100ce96d441fcfe847ec2d46edcc9db91 Mon Sep 17 00:00:00 2001 From: Adam Hughes <9903835+tri-adam@users.noreply.github.com> Date: Thu, 10 Aug 2023 18:41:21 +0000 Subject: [PATCH 2/4] build(deps): bump github.com/ProtonMail/go-crypto from v0.0.0-20230710112148-e01326fd72eb to v0.0.0-20230717121422-5aa5874ade95 Signed-off-by: Dave Dykstra <2129743+DrDaveD@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index b93cfa7..21976f6 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/apptainer/sif/v2 go 1.20 require ( - github.com/ProtonMail/go-crypto v0.0.0-20230710112148-e01326fd72eb + github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 github.com/google/go-containerregistry v0.16.1 github.com/google/uuid v1.3.1 github.com/sebdah/goldie/v2 v2.5.3 diff --git a/go.sum b/go.sum index 8f6514b..312dbbf 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/ProtonMail/go-crypto v0.0.0-20230710112148-e01326fd72eb h1:RU+Ff2vE68zFQSoBqlb/LChFztEWWJ9EZ8LU4gA3ubU= -github.com/ProtonMail/go-crypto v0.0.0-20230710112148-e01326fd72eb/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= +github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 h1:KLq8BE0KwCL+mmXnjLWEAOYO+2l2AE4YMmqG1ZpZHBs= +github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= From 1398c803e9761dcc2bf341e0249e5ef0807031a7 Mon Sep 17 00:00:00 2001 From: Adam Hughes <9903835+tri-adam@users.noreply.github.com> Date: Thu, 10 Aug 2023 18:52:46 +0000 Subject: [PATCH 3/4] ci: bump golangci-lint to v1.54 Signed-off-by: Dave Dykstra <2129743+DrDaveD@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 47b4343..49f73c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,7 +41,7 @@ jobs: - name: Install Lint uses: golangci/golangci-lint-action@v2 with: - version: v1.53 + version: v1.54 skip-pkg-cache: true skip-build-cache: true From 4639822c5e4bef025e524bd703c88e915a8638f4 Mon Sep 17 00:00:00 2001 From: Adam Hughes <9903835+tri-adam@users.noreply.github.com> Date: Mon, 21 Aug 2023 19:34:06 +0000 Subject: [PATCH 4/4] chore: remove unnecessary nolint:errorlint lines As of v1.4.4, go-errorlint exempts `Is` methods from type assertions (see https://github.com/polyfloyd/go-errorlint/issues/50). Signed-off-by: Dave Dykstra <2129743+DrDaveD@users.noreply.github.com> --- pkg/integrity/metadata.go | 4 +--- pkg/integrity/select.go | 3 +-- pkg/integrity/verify.go | 1 - pkg/sif/descriptor_input.go | 1 - 4 files changed, 2 insertions(+), 7 deletions(-) diff --git a/pkg/integrity/metadata.go b/pkg/integrity/metadata.go index f7dd60c..491f47f 100644 --- a/pkg/integrity/metadata.go +++ b/pkg/integrity/metadata.go @@ -2,7 +2,7 @@ // Apptainer a Series of LF Projects LLC. // For website terms of use, trademark policy, privacy policy and other // project policies see https://lfprojects.org/policies -// Copyright (c) 2020-2021, 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. @@ -44,7 +44,6 @@ func (e *DescriptorIntegrityError) Error() string { // Is compares e against target. If target is a DescriptorIntegrityError and matches e or target // has a zero value ID, true is returned. func (e *DescriptorIntegrityError) Is(target error) bool { - //nolint:errorlint // don't compare wrapped errors in Is() t, ok := target.(*DescriptorIntegrityError) if !ok { return false @@ -67,7 +66,6 @@ func (e *ObjectIntegrityError) Error() string { // Is compares e against target. If target is a ObjectIntegrityError and matches e or target has a // zero value ID, true is returned. func (e *ObjectIntegrityError) Is(target error) bool { - //nolint:errorlint // don't compare wrapped errors in Is() t, ok := target.(*ObjectIntegrityError) if !ok { return false diff --git a/pkg/integrity/select.go b/pkg/integrity/select.go index f0e6c53..c8cda40 100644 --- a/pkg/integrity/select.go +++ b/pkg/integrity/select.go @@ -2,7 +2,7 @@ // Apptainer a Series of LF Projects LLC. // For website terms of use, trademark policy, privacy policy and other // project policies see https://lfprojects.org/policies -// 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. @@ -72,7 +72,6 @@ func (e *SignatureNotFoundError) Error() string { // Is compares e against target. If target is a SignatureNotFoundError and matches e or target has // a zero value ID, true is returned. func (e *SignatureNotFoundError) Is(target error) bool { - //nolint:errorlint // don't compare wrapped errors in Is() t, ok := target.(*SignatureNotFoundError) if !ok { return false diff --git a/pkg/integrity/verify.go b/pkg/integrity/verify.go index d4b5e5a..eecafe9 100644 --- a/pkg/integrity/verify.go +++ b/pkg/integrity/verify.go @@ -63,7 +63,6 @@ func (e *SignatureNotValidError) Unwrap() error { // Is compares e against target. If target is a SignatureNotValidError and matches e or target has // a zero value ID, true is returned. func (e *SignatureNotValidError) Is(target error) bool { - //nolint:errorlint // don't compare wrapped errors in Is() t, ok := target.(*SignatureNotValidError) if !ok { return false diff --git a/pkg/sif/descriptor_input.go b/pkg/sif/descriptor_input.go index facf4f8..da52223 100644 --- a/pkg/sif/descriptor_input.go +++ b/pkg/sif/descriptor_input.go @@ -115,7 +115,6 @@ func (e *unexpectedDataTypeError) Error() string { } func (e *unexpectedDataTypeError) Is(target error) bool { - //nolint:errorlint // don't compare wrapped errors in Is() t, ok := target.(*unexpectedDataTypeError) if !ok { return false