-
Notifications
You must be signed in to change notification settings - Fork 758
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
Prepend terminal PATH when go.goroot is set #544
Comments
@segevfiner I thought I fixed this long ago - unfortunately, it still needs the window reload. Or do you mean that the PATH should be mutated automatically when |
I have workspace where I set VS Code 1.48.0 on macOS 1.14.6 |
Thanks. Strange that Given that you are using macOS, I wonder if any of the conditions here ( vscode-go/src/goEnvironmentStatus.ts Lines 304 to 313 in 18eaf7e
|
Thanks @segevfiner
Maybe I misinterpreted the comment here microsoft/vscode#99878 (comment) |
Change https://golang.org/cl/251161 mentions this issue: |
This fix completely broke my workflow with multiple Go versions for different workspaces. I'm using Nix package manager and nix-shell + direnv for settings specific to projects. So I have one Go version installed globally with Nix and another one set with nix-shell for my project. It was working fine (because by default VS Code by default adds '-l' to shell arguments) for integrated terminal and PATH mutation was not invoked. But now it mangles my PATH and overrides any Go version I've set in PATH with I don't know why this is needed at all, why can't the extension just use whatever Go version is in the PATH without mutating it? |
Maybe it shouldn't do this when |
@segevfiner would be lovely! |
Change https://golang.org/cl/256938 mentions this issue: |
When the extension chooses a different version of go than the one from the system default - because the user has configured `go.goroot` or `go.alternateTools.go`, or used the `Go: Choose Go Environment` command - the extension mutates the `PATH` (or `Path` on windows) environment variable so all the underlying tools pick the same go version. It also changes the environment variable collection used in the integrated terminal so when the user invokes `go` from the terminal, they use the go version consistent with the extension. But this behavior can conflict with external version management software. Change the PATH environment only if the extension is configured to choose the go binary. Fixes #679. Update #544. Change-Id: I9f7acb26b752ed33dbde2b238a67ed09616b43e5 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/256938 Trust: Hyang-Ah Hana Kim <[email protected]> Run-TryBot: Hyang-Ah Hana Kim <[email protected]> TryBot-Result: kokoro <[email protected]> Reviewed-by: Suzy Mueller <[email protected]>
Change https://golang.org/cl/258077 mentions this issue: |
When the extension chooses a different version of go than the one from the system default - because the user has configured `go.goroot` or `go.alternateTools.go`, or used the `Go: Choose Go Environment` command - the extension mutates the `PATH` (or `Path` on windows) environment variable so all the underlying tools pick the same go version. It also changes the environment variable collection used in the integrated terminal so when the user invokes `go` from the terminal, they use the go version consistent with the extension. But this behavior can conflict with external version management software. Change the PATH environment only if the extension is configured to choose the go binary. Fixes #679. Update #544. Change-Id: I9f7acb26b752ed33dbde2b238a67ed09616b43e5 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/256938 Trust: Hyang-Ah Hana Kim <[email protected]> Run-TryBot: Hyang-Ah Hana Kim <[email protected]> TryBot-Result: kokoro <[email protected]> Reviewed-by: Suzy Mueller <[email protected]> (cherry picked from commit ab4b257) Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/258077
Is your feature request related to a problem? Please describe.
When using
go.goroot
to set an alternate Go version for a specific workspace, the terminal still uses the defaultPATH
which leads thego
command in the terminal to point to the default Go installation.Describe the solution you'd like
Set the
PATH
in the terminal. (In a similar way to what is done when usingGo: Choose Go Environment
?)Of course, this needs to be careful not to mangle the
PATH
, it should only really prepend the version and that's it, not set the entire variable.Describe alternatives you've considered
Having to keep setting it manually...
The text was updated successfully, but these errors were encountered: