-
Notifications
You must be signed in to change notification settings - Fork 819
Closed
Labels
FrozenDueToAgeHelpWantedIssues that are not prioritized by the maintainers. Help is requested from community contributors.Issues that are not prioritized by the maintainers. Help is requested from community contributors.NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
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.go1.18.9 darwin/arm64
- Run
gopls -v version
to get version of Gopls from the VS Code integrated terminal.v0.11.0
- Run
code -v
orcode-insiders -v
to get version of VS Code or VS Code Insiders.1.74.3
- Check your installed extensions to get the version of the VS Code Go extension
v0.38.0-dev
- Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) >
Go: Locate Configured Go Tools
command.- not possible (due to the nature of the bug)
Share the Go related settings you have added/edited
N/A
Describe the bug
When using the vscode-go extension along with an extension like direnv that updates the PATH
, I get the error:
Failed to find the "go" binary in either GOROOT() or PATH(...)
After some brief debugging I determined the issue to be with getBinPathWithPreferredGopathGorootWithExplanation
which uses the cached envPath
instead of the most up to date PATH
from process.env
.
I tested with this function updated to pull the path every time and this has resolved the issue. Code I used in my fork here for reference: master...ciiqr:vscode-go:fix/direnv-support
Steps to reproduce the behavior:
- install go/direnv extensions
- added an
.envrc
to my project with the contents:PATH_add /path/to/go/bin
(assuming go isn't already in your path) - ran command:
direnv: Reset and reload environment
to update the path - clicked
Restart
on the popup direnv produces to reload all extensions - go extension pops up with the
Failed to find the "go" binary...
error (with/path/to/go/bin
clearly not in the path it shows)
Screenshots or recordings
yonran, alecthomas, sun617 and rony-arnac
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeHelpWantedIssues that are not prioritized by the maintainers. Help is requested from community contributors.Issues that are not prioritized by the maintainers. Help is requested from community contributors.NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.