golang / vscode-go

Go extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=golang.Go
Other
3.79k stars 728 forks source link

Choosing Go version by browsing silently fails due to go.mod #3215

Closed firelizzard18 closed 4 months ago

firelizzard18 commented 4 months ago

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

Version Information
* Run `code -v` or `code-insiders -v` to get version of VS Code or VS Code Insiders. - 1.86.2 903b1e9d8990623e3d7da1df3d33db3e42d80eda x64 * Check your installed extensions to get the version of the VS Code Go extension - v0.41.1

Describe the bug

Manually choosing a Go binary as the Go version silently fails (no notification) if go.mod requires a newer version than the binary.

Steps to reproduce the behavior:

  1. Set the Go version to 1.22.
  2. Open a Go project and set go 1.22 in go.mod.
  3. Click on the 1.22.0 ⚡ status bar icon.
  4. Select Choose Go Environment.
  5. Select Choose from file browser.
  6. Choose a 1.21 or earlier binary.
  7. It silently fails.

Logs:

2024-02-29 19:49:00.756 [info] failed to run "/usr/local/go/bin/go version": Error: Command failed: /usr/local/go/bin/go version
go: downloading go1.22 (darwin/amd64)
go: download go1.22 for darwin/amd64: toolchain not available
adonovan commented 4 months ago

Thanks for reporting this; it's a definite problem that we plan to fix. I'm going to close this issue as it is essentially a dup of #3032.