diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d413379..d2259bf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,9 +38,9 @@ jobs: cache: false # see actions/setup-go#368 - uses: actions/checkout@v6 - - uses: golangci/golangci-lint-action@v6 + - uses: golangci/golangci-lint-action@v9 with: - version: v1.61.0 + version: v2.6.2 skip-cache: true args: --timeout=5m diff --git a/.golangci.yml b/.golangci.yml index d574fe1..d02cfb8 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,32 +1,49 @@ +version: "2" linters: enable: - copyloopvar - - gofmt - - goimports + - dupword - gosec - - ineffassign - misspell - nolintlint - revive - - staticcheck - - tenv # Detects using os.Setenv instead of t.Setenv since Go 1.17 - unconvert - - unused - - govet - - dupword # Checks for duplicate words in the source code disable: - errcheck - -run: - timeout: 5m - -issues: - exclude-dirs: - - api - - cluster - - design - - docs - - docs/man - - releases - - reports - - test # e2e scripts + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + paths: + - api + - cluster + - design + - docs + - docs/man + - releases + - reports + - test + - third_party$ + - builtin$ + - examples$ +formatters: + enable: + - gofmt + - goimports + exclusions: + generated: lax + paths: + - api + - cluster + - design + - docs + - docs/man + - releases + - reports + - test + - third_party$ + - builtin$ + - examples$ diff --git a/go.mod b/go.mod index 89a612d..8cf377b 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/containerd/plugin -go 1.20 +go 1.22 require github.com/opencontainers/image-spec v1.1.0 diff --git a/plugin_test.go b/plugin_test.go index 0c52f6c..671149c 100644 --- a/plugin_test.go +++ b/plugin_test.go @@ -520,7 +520,7 @@ func testPlugin(t Type, id string, i interface{}, err error) *Plugin { func BenchmarkGraph(b *testing.B) { register := testRegistry() b.ResetTimer() - for i := 0; i < b.N; i++ { + for range b.N { register.Graph(mockPluginFilter) } } @@ -528,7 +528,7 @@ func BenchmarkGraph(b *testing.B) { func BenchmarkUnique(b *testing.B) { register := testRegistry() b.ResetTimer() - for i := 0; i < b.N; i++ { + for range b.N { checkUnique(register, &Registration{ Type: InternalPlugin, ID: "new",