diff --git a/src/goLanguageServer.ts b/src/goLanguageServer.ts index 69b80884d1..bb0be8d75c 100644 --- a/src/goLanguageServer.ts +++ b/src/goLanguageServer.ts @@ -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. diff --git a/src/goToolsInformation.ts b/src/goToolsInformation.ts index 5df956c169..f24125a1a7 100644 --- a/src/goToolsInformation.ts +++ b/src/goToolsInformation.ts @@ -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'), diff --git a/test/testdata/helloWorldServer/go.mod b/test/testdata/helloWorldServer/go.mod index 602e8b29cc..64a8a23a37 100644 --- a/test/testdata/helloWorldServer/go.mod +++ b/test/testdata/helloWorldServer/go.mod @@ -1,3 +1,3 @@ module hello-world -go 1.12 +go 1.13 diff --git a/tools/allTools.ts.in b/tools/allTools.ts.in index b08805419b..237c9eb016 100644 --- a/tools/allTools.ts.in +++ b/tools/allTools.ts.in @@ -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'),