-
Notifications
You must be signed in to change notification settings - Fork 752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to find the "go" binary with direnv #2617
Comments
In general we do not update our environment after the extension host has started (doing so in full generality could be quite complicated). I'm not sure we will be able to fix this. Do you find that other extensions do not have this problem? |
Aha, thanks for the additional info -- much appreciated. Also: I missed your patch above, thanks for highlighting it. We'll investigate. If you want, feel free to send a PR with your fix -- it looks reasonable to me, though I'm not an expert on the extension. |
I had the same issue |
Change https://go.dev/cl/494555 mentions this issue: |
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: