From 30dc9b4b3fed4cd861c52b42d5ad359cd0aaa714 Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Tue, 9 Sep 2025 21:26:07 -0400 Subject: [PATCH 1/2] Start error message with non-capitalized letter Signed-off-by: Stefan Berger --- images/encryption/encryption.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/encryption/encryption.go b/images/encryption/encryption.go index 3c734e85..120f8496 100644 --- a/images/encryption/encryption.go +++ b/images/encryption/encryption.go @@ -409,7 +409,7 @@ func cryptManifestList(ctx context.Context, cs content.Store, desc ocispec.Descr newManifests = append(newManifests, newManifest) } if cryptoOp == cryptoOpUnwrapOnly { - return ocispec.Descriptor{}, false, fmt.Errorf("No manifest found for local platform") + return ocispec.Descriptor{}, false, fmt.Errorf("no manifest found for local platform") } if modified { From 9c673b20127fa438372580bd2210083ba149fa52 Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Tue, 9 Sep 2025 21:27:27 -0400 Subject: [PATCH 2/2] ci: Upgrade to golangci-lint v2.4.0 Signed-off-by: Stefan Berger --- .github/workflows/ci.yml | 4 +-- .golangci.bck.yml | 31 +++++++++++++++++++++ .golangci.yml | 58 +++++++++++++++++++++++----------------- 3 files changed, 66 insertions(+), 27 deletions(-) create mode 100644 .golangci.bck.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e4c96548..a42994b1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,9 +53,9 @@ jobs: echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV echo "${{ github.workspace }}/bin" >> $GITHUB_PATH - - uses: golangci/golangci-lint-action@v3 + - uses: golangci/golangci-lint-action@v8.0.0 with: - version: v1.62.2 + version: v2.4.0 working-directory: src/github.com/containerd/imgcrypt args: --timeout 120s diff --git a/.golangci.bck.yml b/.golangci.bck.yml new file mode 100644 index 00000000..cfafb9ad --- /dev/null +++ b/.golangci.bck.yml @@ -0,0 +1,31 @@ +linters: + enable: + - depguard + - staticcheck + - unconvert + - gofmt + - goimports + - govet + - revive + - ineffassign + - unused + - misspell + +issue: + exclude-dirs: + - cmd/ctr/commands/run + - cmd/ctr/commands/images + - cmd\\ctr\\commands\\run + - cmd\\ctr\\commands\\images + exclude-files: + - cmd/ctr/commands/commands.go + - cmd\\ctr\\commands\\commands.go + +linters-settings: + depguard: + rules: + main: + files: + - $all + deny: + - pkg: "io/ioutil" diff --git a/.golangci.yml b/.golangci.yml index cfafb9ad..0e822836 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,31 +1,39 @@ +version: "2" linters: enable: - depguard - - staticcheck + - misspell + - revive - unconvert + settings: + depguard: + rules: + main: + files: + - $all + deny: + - pkg: io/ioutil + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + paths: + - cmd/ctr/commands/run + - cmd/ctr/commands/images + - cmd\\ctr\\commands\\run + - cmd\\ctr\\commands\\images + - cmd/ctr/commands/commands.go + - cmd\\ctr\\commands\\commands.go +formatters: + enable: - gofmt - goimports - - govet - - revive - - ineffassign - - unused - - misspell - -issue: - exclude-dirs: - - cmd/ctr/commands/run - - cmd/ctr/commands/images - - cmd\\ctr\\commands\\run - - cmd\\ctr\\commands\\images - exclude-files: - - cmd/ctr/commands/commands.go - - cmd\\ctr\\commands\\commands.go - -linters-settings: - depguard: - rules: - main: - files: - - $all - deny: - - pkg: "io/ioutil" + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$