Failed to find the "go" binary with direnv #2617
Labels
FrozenDueToAge
HelpWanted
Issues that are not prioritized by the maintainers. Help is requested from community contributors.
NeedsFix
The path to resolution is known, but the work has not been done.
Milestone
What version of Go, VS Code & VS Code Go extension are you using?
Version Information
go version
to get version of Go from the VS Code integrated terminal.go1.18.9 darwin/arm64
gopls -v version
to get version of Gopls from the VS Code integrated terminal.v0.11.0
code -v
orcode-insiders -v
to get version of VS Code or VS Code Insiders.1.74.3
v0.38.0-dev
Go: Locate Configured Go Tools
command.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 cachedenvPath
instead of the most up to datePATH
fromprocess.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:
.envrc
to my project with the contents:PATH_add /path/to/go/bin
(assuming go isn't already in your path)direnv: Reset and reload environment
to update the pathRestart
on the popup direnv produces to reload all extensionsFailed to find the "go" binary...
error (with/path/to/go/bin
clearly not in the path it shows)Screenshots or recordings
The text was updated successfully, but these errors were encountered: