-
Notifications
You must be signed in to change notification settings - Fork 797
Linter settings ignored #3396
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
Comments
That warning came from the gopls. If it was from golangci-lint, you should see "golangci-lint" in the diagnostics info instead of Disable it uisng https://github.com/golang/vscode-go/wiki/settings#uidiagnosticanalyses |
So it really is a gopls issue in terms of gopls looking at other settings? It would imho make sense if |
No, neither BTW, I thought |
Indeed. It would be nice if gopls and vscode-go would share the same underlying setting.
loopclosure is no longer needed on Go 1.22. Afaiu it does not detect the go version and will hence raise false positives on later go versions. |
loopclosure looks at the GoVersion of the file. To over simplify, this is version in the go.mod file for the module which can be overridden by build tags. loopclosure skips files if they are "known to come after language version 1.22". So if it is not the only analyzer you are running, it will be either be very fast, bordering on free, if your module is after 1.22. Or the file is <= 1.21 and it is relevant. So I don't think you gain much by selectively turning it off. (The big caveat is if you are seeing false positives due to actual problems with "known to come after language version 1.22". That is mostly likely an issue with plumbing the GoVersion correctly to go/types in the tool though.) |
Seems this is turning into a
I have
in |
Not unless you are specifying a lower GoVersion for the file using buildtags. There is also a chance that go versions are not being appropriately piped in gopls. cc @findleyr |
I wasn't even aware that was possible. No version buildtags! |
We're going to cut gopls@v0.15.4 anyway due to golang/go#67545. That release will include the fix to the loopclosure analyzer so that it properly detects go1.22. |
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
go version
to get version of Go from the VS Code integrated terminal.gopls -v version
to get version of Gopls from the VS Code integrated terminal.code -v
orcode-insiders -v
to get version of VS Code or VS Code Insiders.Go: Locate Configured Go Tools
command.Share the Go related settings you have added/edited
Run
Preferences: Open Settings (JSON)
command to open your settings.json file.Share all the settings with the
go.
or["go"]
orgopls
prefixes.User settings:
Workspace settings:
Describe the bug
According to workspace, golangci-lint is the linter of choice.
.golangci.yml
looks like this:loopclosure
is disabled. Still, I seeloopclosure
errors (screenshot below). It seems linter settings are ignored.Steps to reproduce the behavior:
Open workspace, look at output.
Screenshots or recordings
The text was updated successfully, but these errors were encountered: