Skip to content

Commit

Permalink
src/goToolsInformation: require go1.13+ for gopls
Browse files Browse the repository at this point in the history
Gopls v0.8.0+ will require go1.13+ for build.

And, skip gopls shouldUpdateLanguageServer check.

Fixes #2030

Change-Id: If8fdc14553337c4a9bb3f8caae15ace2aa60e0eb
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/381214
Trust: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
  • Loading branch information
hyangah committed Jan 28, 2022
1 parent 0a9d740 commit d5403b9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/goLanguageServer.ts
Expand Up @@ -1072,6 +1072,12 @@ export async function shouldUpdateLanguageServer(
return null;
}

// If the Go version is too old, don't update.
const goVersion = await getGoVersion();
if (!goVersion || (tool.minimumGoVersion && goVersion.lt(tool.minimumGoVersion.format()))) {
return null;
}

// First, run the "gopls version" command and parse its results.
// TODO(rstambler): Confirm that the gopls binary's modtime matches the
// modtime in the config. Update it if needed.
Expand Down
2 changes: 1 addition & 1 deletion src/goToolsInformation.ts
Expand Up @@ -202,7 +202,7 @@ export const allToolsInformation: { [key: string]: Tool } = {
isImportant: true,
description: 'Language Server from Google',
usePrereleaseInPreviewMode: true,
minimumGoVersion: semver.coerce('1.12'),
minimumGoVersion: semver.coerce('1.13'),
latestVersion: semver.parse('v0.7.5'),
latestVersionTimestamp: moment('2022-01-18', 'YYYY-MM-DD'),
latestPrereleaseVersion: semver.parse('v0.7.5'),
Expand Down
2 changes: 1 addition & 1 deletion test/testdata/helloWorldServer/go.mod
@@ -1,3 +1,3 @@
module hello-world

go 1.12
go 1.13
2 changes: 1 addition & 1 deletion tools/allTools.ts.in
Expand Up @@ -200,7 +200,7 @@ export const allToolsInformation: { [key: string]: Tool } = {
isImportant: true,
description: 'Language Server from Google',
usePrereleaseInPreviewMode: true,
minimumGoVersion: semver.coerce('1.12'),
minimumGoVersion: semver.coerce('1.13'),
latestVersion: semver.parse('%s'),
latestVersionTimestamp: moment('%s', 'YYYY-MM-DD'),
latestPrereleaseVersion: semver.parse('%s'),
Expand Down

0 comments on commit d5403b9

Please sign in to comment.