ci: bump to golangci-lint v2.0

The new configuration file was initially generated by golangci-lint
migrate, when tweaked to minimize and simplify.

golangci-lint v2 switches to a new version of staticcheck which shows
much more warnings. Some of them were fixed by a few previous commits,
and the rest of them are disabled.

In particular, ST1005 had to be disabled (an attempt to fix it was made
in https://github.com/opencontainers/runc/pull/3857 but it wasn't
merged).

Also, golangci-extra was modified to include ALL staticcheck linters.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2025-03-24 11:45:39 -07:00
parent 9b3ccc19a6
commit 127e8e68d3
3 changed files with 28 additions and 10 deletions
+19 -7
View File
@@ -1,18 +1,30 @@
# For documentation, see https://golangci-lint.run/usage/configuration/
version: "2"
run:
build-tags:
- seccomp
linters:
formatters:
enable:
- gofumpt
linters:
enable:
- errorlint
- nolintlint
- unconvert
- unparam
linters-settings:
govet:
enable:
- nilness
settings:
govet:
enable:
- nilness
staticcheck:
checks:
- all
- -ST1000 # https://staticcheck.dev/docs/checks/#ST1000 Incorrect or missing package comment.
- -ST1003 # https://staticcheck.dev/docs/checks/#ST1003 Poorly chosen identifier.
- -ST1005 # https://staticcheck.dev/docs/checks/#ST1005 Incorrectly formatted error string.
- -QF1008 # https://staticcheck.dev/docs/checks/#QF1008 Omit embedded fields from selector expression.
exclusions:
presets:
- std-error-handling