Skip to content

Commit 73e7c36

Browse files
committed
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]>
1 parent 9a9a216 commit 73e7c36

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
@@ -277,8 +277,7 @@ export async function installTool(
277277
const execFile = util.promisify(cp.execFile);
278278
const { stdout, stderr } = await execFile(goBinary, args, opts);
279279
output = `${stdout} ${stderr}`;
280-
logVerbose('install: %s %s\n%s%s', goBinary, args.join(' '), stdout, stderr);
281-
280+
logVerbose(`install: ${goBinary} ${args.join(' ')}\n${stdout}${stderr}`);
282281
if (hasModSuffix(tool) || tool.name === 'dlv-dap') {
283282
// Actual installation of the -gomod tool and dlv-dap is done by running go build.
284283
const gopath = env['GOBIN'] || env['GOPATH'];

src/goLanguageServer.ts

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

1011-
export async function shouldUpdateLanguageServer(tool: Tool, cfg: LanguageServerConfig): Promise<semver.SemVer> {
1011+
export async function shouldUpdateLanguageServer(
1012+
tool: Tool,
1013+
cfg: LanguageServerConfig,
1014+
mustCheck?: boolean
1015+
): Promise<semver.SemVer> {
10121016
// Only support updating gopls for now.
1013-
if (tool.name !== 'gopls' || cfg.checkForUpdates === 'off' || IsInCloudIDE) {
1017+
if (tool.name !== 'gopls' || (!mustCheck && (cfg.checkForUpdates === 'off' || IsInCloudIDE))) {
10141018
return null;
10151019
}
10161020

@@ -1488,7 +1492,7 @@ async function suggestGoplsIssueReport(
14881492
// just prompt them to update, not file an issue.
14891493
const tool = getTool('gopls');
14901494
if (tool) {
1491-
const versionToUpdate = await shouldUpdateLanguageServer(tool, latestConfig);
1495+
const versionToUpdate = await shouldUpdateLanguageServer(tool, latestConfig, true);
14921496
if (versionToUpdate) {
14931497
promptForUpdatingTool(tool.name, versionToUpdate, true);
14941498
return;
@@ -1567,6 +1571,7 @@ You will be asked to provide additional information and logs, so PLEASE READ THE
15671571
// Get the user's version in case the update prompt above failed.
15681572
const usersGoplsVersion = await getLocalGoplsVersion(latestConfig);
15691573
const extInfo = getExtensionInfo();
1574+
const goVersion = await getGoVersion();
15701575
const settings = latestConfig.flags.join(' ');
15711576
const title = `gopls: automated issue report (${errKind})`;
15721577
const goplsLog = sanitizedLog
@@ -1583,7 +1588,9 @@ Failed to auto-collect gopls trace: ${failureReason}.
15831588
const body = `
15841589
gopls version: ${usersGoplsVersion}
15851590
gopls flags: ${settings}
1591+
update flags: ${latestConfig.checkForUpdates}
15861592
extension version: ${extInfo.version}
1593+
go version: ${goVersion?.format(true)}
15871594
environment: ${extInfo.appName} ${process.platform}
15881595
initialization error: ${initializationError}
15891596
manual restart count: ${manualRestartCount}

src/goTools.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -427,10 +427,10 @@ export const allToolsInformation: { [key: string]: Tool } = {
427427
description: 'Language Server from Google',
428428
usePrereleaseInPreviewMode: true,
429429
minimumGoVersion: semver.coerce('1.12'),
430-
latestVersion: semver.coerce('0.6.6'),
431-
latestVersionTimestamp: moment('2021-02-22', 'YYYY-MM-DD'),
432-
latestPrereleaseVersion: semver.coerce('0.6.6'),
433-
latestPrereleaseVersionTimestamp: moment('2021-02-22', 'YYYY-MM-DD')
430+
latestVersion: semver.coerce('0.6.8'),
431+
latestVersionTimestamp: moment('2021-03-17', 'YYYY-MM-DD'),
432+
latestPrereleaseVersion: semver.coerce('0.6.8'),
433+
latestPrereleaseVersionTimestamp: moment('2021-03-17', 'YYYY-MM-DD')
434434
},
435435
'dlv': {
436436
name: 'dlv',

0 commit comments

Comments
 (0)