vscode-go icon indicating copy to clipboard operation
vscode-go copied to clipboard

Go 1.24 Tool Directive: Add support for tool dependencies from `go get tool`

Open Zenthae opened this issue 5 months ago • 4 comments

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

Version Information
  • Run go version to get version of Go from the VS Code integrated terminal.
    • 1.24.1
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
    • 0.19.1
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
    • 1.97.0
  • Check your installed extensions to get the version of the VS Code Go extension
    • 0.48.0
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.

Share the Go related settings you have added/edited

  "go.alternateTools": {
    "customFormatter": "golangci-lint"
  },
  "go.formatFlags": ["fmt", "--stdin"],
  "go.formatTool": "custom",
  "go.inlayHints.assignVariableTypes": true,
  "go.inlayHints.compositeLiteralFields": true,
  "go.inlayHints.constantValues": true,
  "go.inlayHints.rangeVariableTypes": true,
  "go.lintFlags": ["--path-mode=abs"],
  "go.lintTool": "golangci-lint",
  "go.testFlags": ["-v"],
  "go.useLanguageServer": true,

Describe the bug

The extension is not detecting golangci-lint when it's installed with the new command go get -tool. It will use the embedded v1 version.

Steps to reproduce the behavior:

  1. Run go get -tool github.com/golangci/golangci-lint/v2/cmd/[email protected]
  2. Start vscode
  3. try to lint go code, it will use the embedded v1 version and throw an error about unknown flag: --path-mode

Screenshots or recordings

If applicable, add screenshots or recordings to help explain your problem.

Zenthae avatar Jul 05 '25 15:07 Zenthae