Skip to content

Commit 03cb3c6

Browse files
committed
[release] src/goMain: remove tools version check hack
The existing tool version checks in suggestUpdates simply compare the go version & GOROOT/GOPATH used with the tool last time. That is a hack added when there was no good way to check tool's exact versions and users organize compatible tools using GOPATH. Now many of recent tools (e.g. gopls) do not depend on hardcoded GOROOT or the go version used while compiling the tools. It's still desirable to compile tools with the latest version of go but the go version does not have to match exactly with the go version used to compile the tools. For example, tools compiled with go1.16 can be used to work with go1.16.1 or go1.15. Now Go is released frequently, and the extension allows users to switch between different go versions more easily, this incorrect popup is often annoying and confuses users, than helping users stay up-to-date with latest tools. Remove this incorrect heuristic for now. Updates #487 Fixes #1698 Change-Id: I7a7c6a0d654ae080ea2bd221a366230ebb98bb7e Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/349752 Trust: Hyang-Ah Hana Kim <[email protected]> Run-TryBot: Hyang-Ah Hana Kim <[email protected]> TryBot-Result: kokoro <[email protected]> Reviewed-by: Rebecca Stambler <[email protected]> (cherry picked from commit 23a2db0) Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/349953 Reviewed-by: Suzy Mueller <[email protected]> Trust: Suzy Mueller <[email protected]>
1 parent 5d3b3f6 commit 03cb3c6

File tree

1 file changed

+3
-47
lines changed

1 file changed

+3
-47
lines changed

src/goMain.ts

Lines changed: 3 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -873,54 +873,10 @@ function checkToolExists(tool: string) {
873873
}
874874

875875
async function suggestUpdates(ctx: vscode.ExtensionContext) {
876-
const updateToolsCmdText = 'Update tools';
877-
interface GoInfo {
878-
goroot: string;
879-
version: string;
876+
// TODO(hyangah): this is to clean up the unused key. Delete this code in 2021 Dec.
877+
if (ctx.globalState.get('toolsGoInfo')) {
878+
ctx.globalState.update('toolsGoInfo', null);
880879
}
881-
const toolsGoInfo: { [id: string]: GoInfo } = ctx.globalState.get('toolsGoInfo') || {};
882-
const toolsGopath = getToolsGopath() || getCurrentGoPath();
883-
if (!toolsGoInfo[toolsGopath]) {
884-
toolsGoInfo[toolsGopath] = { goroot: null, version: null };
885-
}
886-
const prevGoroot = toolsGoInfo[toolsGopath].goroot;
887-
const currentGoroot: string = getCurrentGoRoot().toLowerCase();
888-
if (prevGoroot && prevGoroot.toLowerCase() !== currentGoroot) {
889-
vscode.window
890-
.showInformationMessage(
891-
`Your current goroot (${currentGoroot}) is different than before (${prevGoroot}), a few Go tools may need recompiling`,
892-
updateToolsCmdText
893-
)
894-
.then((selected) => {
895-
if (selected === updateToolsCmdText) {
896-
installAllTools(true);
897-
}
898-
});
899-
} else {
900-
const currentVersion = await getGoVersion();
901-
if (currentVersion) {
902-
const prevVersion = toolsGoInfo[toolsGopath].version;
903-
const currVersionString = currentVersion.format();
904-
905-
if (prevVersion !== currVersionString) {
906-
if (prevVersion) {
907-
vscode.window
908-
.showInformationMessage(
909-
'Your Go version is different than before, a few Go tools may need re-compiling',
910-
updateToolsCmdText
911-
)
912-
.then((selected) => {
913-
if (selected === updateToolsCmdText) {
914-
installAllTools(true);
915-
}
916-
});
917-
}
918-
toolsGoInfo[toolsGopath].version = currVersionString;
919-
}
920-
}
921-
}
922-
toolsGoInfo[toolsGopath].goroot = currentGoroot;
923-
ctx.globalState.update('toolsGoInfo', toolsGoInfo);
924880
}
925881

926882
function configureLanguageServer(ctx: vscode.ExtensionContext) {

0 commit comments

Comments
 (0)