golangci/golangci-lint

invalid third argument to the var-naming rule

Closed this issue · 2 comments

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

golangci-lint run error
ERRO [linters_context] setup revive: cannot configure rule: "var-naming": invalid third argument to the var-naming rule. Expecting extraBadPackageNames of type slice of strings, but []interface {}

Version of golangci-lint

$ golangci-lint --version
golangci-lint has version 2.2.2 built with go1.24.2 from (unknown, modified: ?, mod sum: "h1:vuzwYGPzDx9WqN85Fu8F8wqDSZqk8q76ypnznXk6MvM=") on (unknown)

Configuration

version: "2"
run:
  modules-download-mode: readonly
linters:
  enable:
    - revive
  settings:
    revive:
      rules:
        - name: var-naming
          arguments:
            - [ "ID","IP","JSON","URL","HTTP","SQL","CPU","URI" ]
            - [ ]
            - - extra-bad-package-names: [ "common", "types" ]

Go environment

$ go version && go env
go version go1.24.2 linux/amd64
AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/root/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2731312597=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/mnt/e/github/taosadapter/go.mod'
GOMODCACHE='/root/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/root/go'
GOPRIVATE=''
GOPROXY='https://goproxy.cn,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/root/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.24.2'
GOWORK=''
PKG_CONFIG='pkg-config'

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v
ERRO [linters_context] setup revive: cannot configure rule: "var-naming": invalid third argument to the var-naming rule. Expecting extraBadPackageNames of type slice of strings, but []interface {}

A minimal reproducible example or link to a public repository

// add your code here

Validation

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

Supporter

Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.

Hey, this was fixed in mgechev/revive#1404 and is available starting from revive v1.11.0. Currently, golangci-lint v2.2.2 includes revive v1.10.0, so you'll need to wait for the next golangci-lint minor release, which includes #5933.