Closed
Description
Welcome
- Yes, I'm using a binary release within 2 latest major 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 (https://golangci-lint.run/welcome/faq/#why-do-you-have-typecheck-errors).
- Yes, I've tried with the standalone linter if available (e.g., gocritic, go vet, etc.). (https://golangci-lint.run/usage/linters/)
Description of the problem
Since updating to v1.58.0 I'm getting the following errors:
directive `//nolint:gochecknoinits` is unused for linter "gochecknoinits" (nolintlint)
don't use `init` function (init)
If I change //nolint:gochecknoinits
to //nolint:init
I get
WARN [runner/nolint] Found unknown linters in //nolint directives: init
It appears as though the linter was renamed in parts of the application but not all, and most importantly this change isn't documented.
Version of golangci-lint
$ golangci-lint --version
golangci-lint has version 1.58.0 built with go1.22.2 from 28b3813 on 2024-05-02T20:58:31Z
Configuration
linters:
enable-all: true
Go environment
$ go version && go env
go version go1.22.2 darwin/amd64
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/Users/adam/Library/Caches/go-build'
GOENV='/Users/adam/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/adam/go/pkg/mod'
GOOS='darwin'
GOPATH='/Users/adam/go'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/Cellar/go/1.22.2/libexec'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/Cellar/go/1.22.2/libexec/pkg/tool/darwin_amd64'
GOVCS=''
GOVERSION='go1.22.2'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='cc'
CXX='c++'
CGO_ENABLED='1'
GOMOD='***'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/xh/ttknrcjs3tbfv99f83f454d40000gn/T/go-build638368919=/tmp/go-build -gno-record-gcc-switches -fno-common'
Verbose output of running
$ golangci-lint cache clean
$ golangci-lint run -v
# paste output here
A minimal reproducible example or link to a public repository
package main
import (
"fmt"
)
//nolint:gochecknoinits
func init() {
fmt.Println("init")
}
func main() {
fmt.Println("main")
}
Validation
- Yes, I've included all information above (version, config, etc.).