Thanks to visit codestin.com
Credit goes to github.com

Skip to content

go.alternativeTools does not override go.lintToo (or does?) #3862

@vanyauhalin

Description

@vanyauhalin

What version of Go, VS Code & VS Code Go extension are you using?

$ mise version --json | jq -r .version
2025.8.20 macos-arm64 (2025-08-22)

$ go version
go version go1.25.0 darwin/arm64

$ gopls version
golang.org/x/tools/gopls v0.20.0

$ golangci-lint --version
golangci-lint has version 2.4.0 built with go1.25.0 from 43d03392 on 2025-08-13T23:36:29Z

$ code -v
1.103.2
6f17636121051a53c88d3e605c491d22af2ba755
arm64

$ ls ~/.vscode/extensions/ | grep golang.go
golang.go-0.51.0

Share the Go related settings you have added/edited

{
  "go.lintTool": "golangci-lint-v2",
  "go.alternateTools": {
    "go": "~/.local/share/mise/shims/go",
    "golangci-lint": "~/.local/share/mise/shims/golangci-lint",
    "golangci-lint-v2": "~/.local/share/mise/shims/golangci-lint",
    "gopls": "~/.local/share/mise/shims/gopls"
  },
}

Describe the bug

I am using alternativeTools to specify the exact path to the lintTool. This will tell the extension which version of the lint tool to use. And also to resolve this issue #3732. The extensions will ignore alternativeTools and will try to install the lintTool using go, which is not expected when you directly tell which bin to use. Cannot say for sure will the extension will use its own lintTool version or the version from the alternativeTools, because in my case, the extension failed to install the lintTool, which leades to use of the version from the alternativeTools.

2025-09-07 13:57:00.899 [info] Tools environment: GOPATH=/Users/vanyauhalin/.local/share/mise/installs/go/1.25.0/packages, GOBIN=/Users/vanyauhalin/.local/share/mise/installs/go/1.25.0/bin, GOTOOLCHAIN=auto
2025-09-07 13:57:00.900 [info] Installing 1 tool at the configured GOBIN: /Users/vanyauhalin/.local/share/mise/installs/go/1.25.0/bin
2025-09-07 13:57:00.900 [info]   golangci-lint-v2
2025-09-07 13:57:00.900 [info] 
2025-09-07 13:57:00.900 [trace] /Users/vanyauhalin/.local/share/mise/installs/go/1.25.0/bin/go install -v github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest (cwd: /Users/vanyauhalin/self/x/go)
2025-09-07 13:57:04.257 [info] Installing github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest FAILED
2025-09-07 13:57:04.257 [info] {
 "code": 1,
 "killed": false,
 "signal": null,
 "cmd": "/Users/vanyauhalin/.local/share/mise/installs/go/1.25.0/bin/go install -v github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest",
 "stdout": "",
 "stderr": "go: downloading github.com/tdakkota/asciicheck v0.4.1\n../../../.local/share/mise/installs/go/1.25.0/packages/pkg/mod/github.com/golangci/golangci-lint/[email protected]/pkg/golinters/asciicheck/asciicheck.go:4:2: reading github.com/tdakkota/asciicheck/go.mod at revision v0.4.1: git ls-remote -q origin in /Users/vanyauhalin/.local/share/mise/installs/go/1.25.0/packages/pkg/mod/cache/vcs/e91413ff76cb95901df8e2d834855d07c617befa58b5014bc6cd6fd1148034dd: exit status 128:\n\tfatal: could not read Username for 'https://github.com': terminal prompts disabled\nConfirm the import path was entered correctly.\nIf this is a private repository, see https://golang.org/doc/faq#git_https for additional information.\n"
}
2025-09-07 13:57:04.257 [info] install missing tools failed - {"errno":-2,"code":"ENOENT","syscall":"copyfile","path":"/Users/vanyauhalin/.local/share/mise/installs/go/1.25.0/bin/tmp/golangci-lint","dest":"/Users/vanyauhalin/.local/share/mise/installs/go/1.25.0/bin/golangci-lint-v2"}

...

2025-09-07 14:01:33.644 [info] Starting linting the current package at /Users/vanyauhalin/self/x/go
2025-09-07 14:01:34.414 [info] /Users/vanyauhalin/self/x/go>Finished running tool: /Users/vanyauhalin/.local/share/mise/shims/golangci-lint run --issues-exit-code=0 --output.text.print-issued-lines=false --show-stats=false --output.text.path=stdout --path-mode=abs

References

#3732 (comment)
#3861

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions