golang / vscode-go

Go extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=golang.Go
Other
3.87k stars 750 forks source link

Reevaluate the need for tools reinstallations when GOROOT is changed #294

Closed hyangah closed 2 years ago

hyangah commented 4 years ago

This extension keeps track of the GOROOT used last time in ctx.globalState.get('toolsGoInfo'). If use of a different GOROOT is detected when activated, it prompts users to recompile/reinstall Go tools with a message like:

Your current goroot (${currentGoroot}) is different than before (${prevGoroot}), a few Go tools may need recompiling

The code is here https://github.com/golang/vscode-go/blob/89c61d9e3af240858c7b9ea38b4e953b3063b3ad/src/goMain.ts#L94-L127

This was a heuristic to deal with old tools that used the GOROOT embedded during the tool's compile time (See https://github.com/microsoft/vscode-go/issues/1286 for example) in old days. Newer tools shouldn't depend on the value of GOROOT used in the tool's compile time, so recompiling shouldn't be necessary as long as the tool is up-to-date.

Examine tools this extension depends on and check whether they use hard-coded build time GOROOT. Once we know no tools require recompilation any more, remove this popup and the heuristic.

Inspection status (check if investigated && not require recompilation)

cc @stamblerre @mcjcloud @FiloSottile

gopherbot commented 4 years ago

Change https://golang.org/cl/244758 mentions this issue: src/goDeclaration.ts: godef requires the rightGOROOTenv var

hyangah commented 4 years ago

A user reported gocode (or gocode-gomod) needed to be reinstalled when go is updated. (https://github.com/golang/vscode-go/issues/552) Need to verify it.

gopherbot commented 4 years ago

Change https://golang.org/cl/254137 mentions this issue: src/goPackages.ts: pass GOROOT to gopkgs

hyangah commented 2 years ago

The mentioned code that tracks GOROOT change was deleted. Instead, the extension currently checks go version output and compares the tools' build info (go version -m) since v0.32.0 So, I'd say this issue is no longer relevant. Closing this issue.