You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[release] src/goInstallTools.ts: fix PATH adjustment when a different go is chosen
With commits d93a0ae and a5e40ca (microsoft/vscode-go#3152), we tried to
include the go binary's path to the PATH (Path on windows) in order to ensure
all underlying go tools (gofmt, cgo, gopls, ...) that simply invoke 'go'
can find the matching go binary by searching the PATH.
We found that trick does not work when users specifies a different go version
using go.alternateTools and the specified binary is not named 'go'.
For example, golang.org provides an easy way to install extra versions of Go
https://golang.org/doc/install#extra_versions through a wrapper, whose
name includes the version. Users who take this approach should be able to
configure to pick up the chosen version with
```
"go.alternateTools": {
"go": "/Users/username/go/bin/go1.13.11"
}
```
Previously, we just added /Users/username/go/bin (the go binary directory name)
to PATH. Because there is no 'go' binary in this directory, the underlying
tools failed to pick the right go tool.
In this CL, we instead use the GOROOT (found from go env call) and add
GOROOT/bin to the PATH.
In this CL
- We also arrange to call updateGoVarsFromConfig only when the relevant
configs are changed (onDidChangeConfiguration setup in goMain.ts).
Previously, this was called almost on every file save events if the repository
has a workspace setting file (.vscode/setting.json).
- We also changed initGoStatusBar to be called after the goroot is updated.
That eliminates an extra call path (initGoStatusBar -> ... -> updateGoVarsFromConfig,
and also, reflects goroot changes correctly when the configuration is updated.
Updates #146
Updates #26
Change-Id: I9b0e42787308e17547067460960b5fdd8b678991
GitHub-Last-Rev: 995c1a3
GitHub-Pull-Request: #252
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/239697
Reviewed-by: Brayden Cloud <[email protected]>
Reviewed-by: Rebecca Stambler <[email protected]>
(cherry picked from commit 057186f)
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/239981
0 commit comments