-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nonolint fix actual nolint:exhaustive #1940
Comments
And magic. Such code linted ok: func adaptRPState(s fsmrp.StateName) pbRp.State { //nolint:nolintlint
switch s { |
After another yet cache cleaning last working variant: func adaptRPState(s fsmrp.StateName) pbRp.State { //nolint:nolintlint
switch s { //nolint:exhaustive |
Hello, I created a minimal example:
|
@Antonboom any feedback? |
I prepared more complex example similar to project code. func adaptTigerToInt(t tigers.Cat) int {
switch t { //nolint:exhaustive
case tigers.Tiger1:
return 1
}
return 0
}
/*
▶ golangci-lint run .
adapt.go:6:2: missing cases in switch of type cats.Cat: Cat1|Cat2 (exhaustive)
switch t {
^
▶ golangci-lint run .
adapt.go:6:13: directive `//nolint:exhaustive` is unused for linter "exhaustive" (nolintlint)
switch t { //nolint:exhaustive
*/ |
It seems like exhaustive's issue for type alias supporting. |
Yes sounds like an issue with exhaustive, can you open an issue on this repo https://github.com/nishanths/exhaustive |
For anyone arriving here, I've added details in the related issue: nishanths/exhaustive#7 (comment). It appears to be a general issue with golangci-lint not invalidating the cache when source files have changed. |
I have this issue on latest version (1.48.0) and I can confirm it's caching issue. |
My org has seen some issues with false-positive or false-negative that we suspect is due to similar caching issues... Does anyone know if there is already a separate open issue for that (I don't see a link here)? Meanwhile we've just disabled |
This comment was marked as off-topic.
This comment was marked as off-topic.
The lint task was failing at head, due to a nolint:exhaustive error directive that golangci nolintlint believes is unused. Issue seems to be golangci/golangci-lint#3228 and seems to be a bug in golang-ci / nolintlint, using the workaround proposed in golangci/golangci-lint#1940 which is to clear the cache between runs.
Description of the problem
--fix
remove actualnolint
directive.Version of golangci-lint
Config file
Go environment
Verbose output of running
Code example or link to a public repository
I fell into a trap
The text was updated successfully, but these errors were encountered: