Skip to content

Use golangci-lint V2 ,can't load custom linters #6200

@mini-cookie

Description

@mini-cookie

Welcome

  • Yes, I'm using a binary release within 2 latest releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've read the typecheck section of the FAQ.
  • Yes, I've tried with the standalone linter if available (e.g., gocritic, go vet, etc.).
  • I agree to follow this project's Code of Conduct

How did you install golangci-lint?

go install

Description of the problem

I 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-lint

golangci-lint v2.6.2

Configuration

install golangci-lint

CGO_ENABLED=1  go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.6.2

with .custom-gcl.yml, rebuild custom golangci-lint

version: v2.6.2
destination: /golint/plugin
plugins:
  - module: go.uber.org/nilaway
    import: go.uber.org/nilaway/cmd/gclplugin
    version: latest
  - module: sigs.k8s.io/logtools
    import: sigs.k8s.io/logtools/logcheck/gclplugin
    version: latest

CGO_ENABLED=1 golangci-lint custom -v

.golangci-lint.yml to test kubeapilinter plugin

version: "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:
        - kubeapilinter

errors

Error: unknown linters: 'kubeapilinter', run 'golangci-lint help linters' to see the list of supported linters
The command is terminated due to an error: unknown linters: 'kubeapilinter', run 'golangci-lint help linters' to see the list of supported linters

Go environment

Details
go 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

Details
$ golangci-lint cache clean
$ golangci-lint run -v
# paste output here

A minimal reproducible example or link to a public repository

Details
// add your code here

Validation

  • Yes, I've included all information above (version, config, etc.).

Supporter

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions