Use golangci-lint V2 ,can't load custom linters #6201
-
Welcome
How did you install golangci-lint?go install Description of the problemI upgrade golangci-lint version from v1.x to v2.x,but meet the question that golangci-lint binary cann't reload the custom plugin. Even I have tried CGO_ENABLED=1, it doesn't work. Version of golangci-lintgolangci-lint v2.6.2 Configurationinstall golangci-lintwith .custom-gcl.yml, rebuild custom golangci-lintversion: v2.6.2
name: golangci-lint-kube-api-linter
destination: /Users/miaoyuan/Desktop/Yuxi/goPro/src/github.com/golint/plugin
plugins:
- module: 'sigs.k8s.io/kube-api-linter'
version: latest
.golangci-lint.yml to test kubeapilinter pluginversion: "2"
linters-settings:
custom:
kubeapilinter:
type: "module"
description: Kube API Linter lints Kube like APIs based on API conventions and best practices.
settings:
linters: {}
lintersConfig: {}
linters:
disable-all: true
enable:
- kubeapilinter
issues:
exclude-rules:
- path-except: "api/*"
linters:
- kubeapilintererrorsGo environmentgo version go1.24.2 darwin/arm64
AR='ar'
CC='cc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='c++'
GCCGO='gccgo'
GO111MODULE='on'
GOARCH='arm64'
GOARM64='v8.0'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/Users/miaoyuan/Library/Caches/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/Users/miaoyuan/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/qh/tcs4b2kj67s7vqv03lhhd72w0000gp/T/go-build2355623186=/tmp/go-build -gno-record-gcc-switches -fno-common'
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMOD='/dev/null'
GOMODCACHE='/Users/miaoyuan/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/miaoyuan/go'
GOPRIVATE=''
GOPROXY='https://goproxy.cn,direct'
GOROOT='/opt/homebrew/Cellar/go/1.24.2/libexec'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/miaoyuan/Library/Application Support/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/homebrew/Cellar/go/1.24.2/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.24.2'
GOWORK=''
PKG_CONFIG='pkg-config'Verbose output of running$ golangci-lint cache clean
$ golangci-lint run -v
# paste output hereA minimal reproducible example or link to a public repository// add your code hereValidation
Supporter
|
Beta Was this translation helpful? Give feedback.
Answered by
ldez
Nov 17, 2025
Replies: 1 comment 2 replies
-
|
hello, Your configuration is wrong. I recommend reading the documentation on the v1 to v2 migration. https://golangci-lint.run/docs/product/migration-guide/ version: "2"
linters:
default: none
enable:
- nilaway
- logcheck
settings:
custom:
nilaway:
type: module
description: Static analysis tool to detect potential nil panics in Go code.
settings:
"include-pkgs": "*"
logcheck:
type: "module"
description: structured logging checker
original-url: sigs.k8s.io/logtools/logcheck
settings:
check:
contextual: true
config: |
structured .*
contextual .*
exclusions:
presets:
- comments
- common-false-positives
- legacy
- std-error-handling |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
FYI, the documentation of
kube-api-linteris wrong: kubernetes-sigs/kube-api-linter#193