diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 03dfe2e..25a6377 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,9 +38,9 @@ jobs: working-directory: src/github.com/containerd/release-tool - name: Linter - uses: golangci/golangci-lint-action@v6 + uses: golangci/golangci-lint-action@v8 with: - version: v1.64.2 + version: v2.3.1 working-directory: src/github.com/containerd/release-tool - name: Unit Test diff --git a/.golangci.yml b/.golangci.yml index 6311f70..5a7eb9e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,42 +1,37 @@ +version: "2" linters: enable: - - copyloopvar # Checks for loop variable copies in Go 1.22+ - - gofmt - - goimports + - copyloopvar + - dupword - gosec - - ineffassign - misspell - nolintlint - revive - - staticcheck - unconvert - - unused - - govet - - dupword # Checks for duplicate words in the source code disable: - errcheck - + settings: + gosec: + excludes: + - G204 + - G305 + - G306 + - G402 + - G404 + - G115 + nolintlint: + allow-unused: true + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling issues: - include: - - EXC0002 max-issues-per-linter: 0 max-same-issues: 0 - -linters-settings: - gosec: - # The following issues surfaced when `gosec` linter - # was enabled. They are temporarily excluded to unblock - # the existing workflow, but still to be addressed by - # future works. - excludes: - - G204 - - G305 - - G306 - - G402 - - G404 - - G115 - nolintlint: - allow-unused: true - -run: - timeout: 2m +formatters: + enable: + - gofmt + - goimports diff --git a/util.go b/util.go index 272b819..04e84ef 100644 --- a/util.go +++ b/util.go @@ -805,9 +805,10 @@ func resolveGitURL(name string, cache Cache) (string, error) { name, content string ) for _, attr := range tok.Attr { - if attr.Key == "name" { + switch attr.Key { + case "name": name = attr.Val - } else if attr.Key == "content" { + case "content": content = attr.Val } }