Repository navigation
Closed
Labels
area: nolintRelated to nolint directive and nolintlintRelated to nolint directive and nolintlintbugSomething isn't workingSomething isn't working
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 included all information below (version, config, etc).
- Yes, I've tried with the standalone linter if available. (https://golangci-lint.run/usage/linters/)
Description of the problem
We have staticcheck and nonolint enabled.
Sometimes in our CI builds golangci-lint reports a false warnings from nonolint about unused nolint:staticcheck comments.
All warnings that I checked are wrong, the //nolint:staticcheck directives always silence existing deprecation warnings from staticcheck.
I was not able to reproduce this issue.
In CI we reuse the golangci-lint and go cache when running checks on different branches.
It can happen that the same cache was used previously with older go and/or golangci-lint versions.
I believe #1940 (comment) refers to the same issue.
Version of golangci-lint
Details
$ golangci-lint --version
golangci-lint has version 1.49.0 built from cc2d97f3 on 2022-08-24T10:24:37ZConfiguration file
Details
$ cat .golangci.yml
run:
concurrency: 2
deadline: 5m
linters:
disable-all: true
enable:
- depguard
- errcheck
- exportloopref
- goimports
- goprintffuncname
- ineffassign
- misspell
- nolintlint
- revive
- rowserrcheck
- staticcheck
- typecheck
- unconvert
- unused
- vet
issues:
exclude-use-default: falseGo environment
Details
$ go version && go env
[/src/go/code/orders]$ go version && go env
go version go1.19.1 linux/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN="/usr/local/bin"
GOCACHE="/var/cache/go-build"
GOENV="/tmp/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS="-tags=timetzdata -trimpath"
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/var/cache/go-modcache"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/tmp/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19.1"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="0"
GOMOD="/src/go/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1328424340=/tmp/go-build -gno-record-gcc-switches"Verbose output of running
N/A
Code example or link to a public repository
Example case, output from golangci-lint:
[..]/itemdetails.go:36:32: directive `//nolint:staticcheck // Description field is deprecated` is unused for linter "staticcheck" (nolintlint)
return item.Description, nil //nolint:staticcheck // Description field is deprecated
The referenced Description field has a deprecation comment set:
// Deprecated: Do not use.
Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"`Reacted by Francisco Delmar Kurpiel, José Pedro Saraiva, Ian Chamberlain, Andrew Haines, Olivier Boukili, Arve Knudsen, Stavros Ntentos, Scott Talbot, Martin Schneppenheim, Kir Kolyshkin and 9 more
Reacted by silverwind
Metadata
Metadata
Assignees
Labels
area: nolintRelated to nolint directive and nolintlintRelated to nolint directive and nolintlintbugSomething isn't workingSomething isn't working
Activity
ldez commentedon Sep 21, 2022
Hello,
I change some elements related to facts (they are used by staticcheck) maybe the problem will be fixed with the next release (v1.50.0)
fho commentedon Nov 1, 2022
The issue happend again with golangci-lint 1.50.0.
nocive commentedon Mar 3, 2023
Fix lint task in CI
Fix lint task in CI
Disable flaky unused `nolint` detection
Disable flaky unused `nolint` detection
Disable flaky unused `nolint` detection
feat!: Make `runtime.effectiveDerivedRoles` available in CEL expressi…
iwata commentedon Oct 11, 2023
Happened with golangci-lint v1.54.2, too.
ci: disable nolintlint
ci: relax nolintlint
ci: relax nolintlint
ci: relax nolintlint
56 remaining items
backend: remove flaky nolintlint linter
backend: remove flaky nolintlint linter
fix(lint): work around nolintlint false positives from cache bug (#10136
fix(lint): work around nolintlint false positives from cache bug (#10136
fix(lint): work around nolintlint false positives from cache bug (#10136
fix(lint): work around nolintlint false positives from cache bug (#10136
rostislaved commentedon Mar 12, 2026
rostislaved commentedon Mar 13, 2026
silverwind commentedon May 4, 2026
bombsimon commentedon May 4, 2026
silverwind commentedon May 4, 2026
fix(ci): disable golangci-lint cache to avoid nolintlint false positives
fix(ci): Work around `nolintlint` false positives from golangci-lint …