-
Notifications
You must be signed in to change notification settings - Fork 876
Description
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
-
Run
go versionto get version of Go from the VS Code integrated terminal.- go version go1.25.5 linux/amd64
-
Run
gopls -v versionto get version of Gopls from the VS Code integrated terminal.- golang.org/x/tools/gopls v0.21.0
-
Run
code -vorcode-insiders -vto get version of VS Code or VS Code Insiders.- 1.107.0
618725e67565b290ba4da6fe2d29f8fa1d4e3622
x64
- 1.107.0
-
Check your installed extensions to get the version of the VS Code Go extension
- 0.52.1
-
Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) >
Go: Locate Configured Go Toolscommand.
go: /home/beath/.gvm/gos/go1.25.5/bin/go: go version go1.25.5 linux/amd64gotests: not installed
impl: not installed
goplay: not installed
dlv: /home/beath/.gvm/pkgsets/go1.25.5/global/bin/dlv (version: v1.26.0 built with go: go1.25.5)
golangci-lint: /home/beath/.gvm/pkgsets/go1.25.5/global/bin/golangci-lint (version: v2.7.2 built with go: go1.25.4)
gopls: /home/beath/.gvm/pkgsets/go1.25.5/global/bin/gopls (version: v0.21.0 built with go: go1.25.5)
Share the Go related settings you have added/edited
{
"go.lintTool": "golangci-lint",
"go.lintFlags": ["--path-mode=abs"],
"go.formatTool": "custom",
"go.alternateTools": {
"customFormatter": "golangci-lint"
},
"go.formatFlags": ["fmt", "--stdin"]
}
Describe the bug
Commit bca1404 has broken the way this extension resolves the version of golangci-lint. Previously if "go.lintTool" was set to "golangci-lint" it would dynamically determine the version of the binary by running go version -m. Now it determines the version purely based on if "go.lintTool" is "golangci-lint" or "golangci-lint-v2".
This results in previous errors of calling the linter with wrong flags like unknown flag: --print-issued-lines if you have "go.lintTool" set to "golangci-lint" but have v2. Going forward, this would necessarily mean that if you want to use v2 of the linter you must have "go.lintTool" set to "golangci-lint-v2" and also have a "golangci-lint-v2" binary in your $GOPATH/bin. This is kind of annoying though if you still want to keep using "golangci-lint" in the CLI as you must have a "golangci-lint" binary and a "golangci-lint-v2" binary. If this is expected behavior then the golangci-lint integrations documentation must also be edited. If this is not expected I would be happy to make the change.
Steps to reproduce the behavior:
- Install golangci-lint v2 manually via the binary installation method which produces a "golangci-lint" binary in your $GOPATH/bin
- Update the extension to v0.52.0 or later
- Trigger lint from vscode by saving a file
- See error in the output