Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
Update tools prompt when go version is different Fixes #797
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-rao-a committed Jul 17, 2017
1 parent b9f1478 commit 8ee4daf
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/goMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { testAtCursor, testCurrentPackage, testCurrentFile, testPrevious, showTe
import * as goGenerateTests from './goGenerateTests';
import { addImport } from './goImport';
import { installAllTools, checkLanguageServer } from './goInstallTools';
import { isGoPathSet, getBinPath, sendTelemetryEvent, getExtensionCommands } from './util';
import { isGoPathSet, getBinPath, sendTelemetryEvent, getExtensionCommands, getGoVersion } from './util';
import { LanguageClient } from 'vscode-languageclient';
import { clearCacheForTools } from './goPath';
import { addTags, removeTags } from './goModifytags';
Expand All @@ -45,6 +45,23 @@ export function activate(ctx: vscode.ExtensionContext): void {
let toolsGopath = vscode.workspace.getConfiguration('go')['toolsGopath'];

updateGoPathGoRootFromConfig().then(() => {
getGoVersion().then(currentVersion => {
if (currentVersion) {
const prevVersion = ctx.globalState.get('goVersion');
const currVersionString = `${currentVersion.major}.${currentVersion.minor}`;

if (prevVersion !== currVersionString) {
if (prevVersion) {
vscode.window.showInformationMessage('Your Go version is different than before, few Go tools may need re-compiling', 'Update tools').then(selected => {
if (selected === 'Rebuild tools') {
vscode.commands.executeCommand('go.tools.install');
}
});
}
ctx.globalState.update('goVersion', currVersionString);
}
}
});
goListAll();
offerToInstallTools();
let langServerAvailable = checkLanguageServer();
Expand Down

0 comments on commit 8ee4daf

Please sign in to comment.