Skip to content

Commit e5c7441

Browse files
committed
[release] src/goLanguageServer: always check the version before crash report
For dev-version, we still not enforce update (this case should be clear enough to tell apart from the gopls version included in the issue report and is valuable to detect crash report during dev period). And - Add go version used by the extension and the update flag info. - Update gopls latestVersion to v0.6.8. Updates #1300 Updates #1334 Updates #1338 Change-Id: I9965297b164665056dbec68285eb740ec2908f01 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/302832 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 73e7c36) Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/303051
1 parent 42b5009 commit e5c7441

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

src/goInstallTools.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,7 @@ export async function installTool(
261261
const execFile = util.promisify(cp.execFile);
262262
const { stdout, stderr } = await execFile(goBinary, args, opts);
263263
output = `${stdout} ${stderr}`;
264-
logVerbose('install: %s %s\n%s%s', goBinary, args.join(' '), stdout, stderr);
265-
264+
logVerbose(`install: ${goBinary} ${args.join(' ')}\n${stdout}${stderr}`);
266265
if (hasModSuffix(tool)) {
267266
// Actual installation of the -gomod tool is done by running go build.
268267
const gopath = env['GOBIN'] || env['GOPATH'];

src/goLanguageServer.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -989,9 +989,13 @@ function allFoldersHaveSameGopath(): boolean {
989989
return vscode.workspace.workspaceFolders.find((x) => tempGopath !== getCurrentGoPath(x.uri)) ? false : true;
990990
}
991991

992-
export async function shouldUpdateLanguageServer(tool: Tool, cfg: LanguageServerConfig): Promise<semver.SemVer> {
992+
export async function shouldUpdateLanguageServer(
993+
tool: Tool,
994+
cfg: LanguageServerConfig,
995+
mustCheck?: boolean
996+
): Promise<semver.SemVer> {
993997
// Only support updating gopls for now.
994-
if (tool.name !== 'gopls' || cfg.checkForUpdates === 'off' || IsInCloudIDE) {
998+
if (tool.name !== 'gopls' || (!mustCheck && (cfg.checkForUpdates === 'off' || IsInCloudIDE))) {
995999
return null;
9961000
}
9971001

@@ -1501,7 +1505,7 @@ async function suggestGoplsIssueReport(
15011505
// just prompt them to update, not file an issue.
15021506
const tool = getTool('gopls');
15031507
if (tool) {
1504-
const versionToUpdate = await shouldUpdateLanguageServer(tool, latestConfig);
1508+
const versionToUpdate = await shouldUpdateLanguageServer(tool, latestConfig, true);
15051509
if (versionToUpdate) {
15061510
promptForUpdatingTool(tool.name, versionToUpdate, true);
15071511
return;
@@ -1580,6 +1584,7 @@ You will be asked to provide additional information and logs, so PLEASE READ THE
15801584
// Get the user's version in case the update prompt above failed.
15811585
const usersGoplsVersion = await getLocalGoplsVersion(latestConfig);
15821586
const extInfo = getExtensionInfo();
1587+
const goVersion = await getGoVersion();
15831588
const settings = latestConfig.flags.join(' ');
15841589
const title = `gopls: automated issue report (${errKind})`;
15851590
const goplsLog = sanitizedLog
@@ -1596,7 +1601,9 @@ Failed to auto-collect gopls trace: ${failureReason}.
15961601
const body = `
15971602
gopls version: ${usersGoplsVersion}
15981603
gopls flags: ${settings}
1604+
update flags: ${latestConfig.checkForUpdates}
15991605
extension version: ${extInfo.version}
1606+
go version: ${goVersion?.format(true)}
16001607
environment: ${extInfo.appName} ${process.platform}
16011608
initialization error: ${initializationError}
16021609
manual restart count: ${manualRestartCount}

src/goTools.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,10 +361,10 @@ export const allToolsInformation: { [key: string]: Tool } = {
361361
isImportant: true,
362362
description: 'Language Server from Google',
363363
minimumGoVersion: semver.coerce('1.12'),
364-
latestVersion: semver.coerce('0.6.6'),
365-
latestVersionTimestamp: moment('2021-02-22', 'YYYY-MM-DD'),
366-
latestPrereleaseVersion: semver.coerce('0.6.6'),
367-
latestPrereleaseVersionTimestamp: moment('2021-02-22', 'YYYY-MM-DD')
364+
latestVersion: semver.coerce('0.6.8'),
365+
latestVersionTimestamp: moment('2021-03-17', 'YYYY-MM-DD'),
366+
latestPrereleaseVersion: semver.coerce('0.6.8'),
367+
latestPrereleaseVersionTimestamp: moment('2021-03-17', 'YYYY-MM-DD')
368368
},
369369
'dlv': {
370370
name: 'dlv',

0 commit comments

Comments
 (0)