Skip to content

Commit

Permalink
src/goTools: specify gofumpt/golangci-lint versions for old go
Browse files Browse the repository at this point in the history
The latest versions require go1.18+ to build.

Fixes #2485

Change-Id: Iea450333d4e3846abceeb73c430d2a1e1e157ff5
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/441878
Reviewed-by: Suzy Mueller <suzmue@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
  • Loading branch information
hyangah committed Oct 13, 2022
1 parent fc6d532 commit 4f3a371
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/goTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { getFormatTool, usingCustomFormatTool } from './language/legacy/goFormat
import { goLiveErrorsEnabled } from './language/legacy/goLiveErrors';
import { allToolsInformation } from './goToolsInformation';
import { getBinPath, GoVersion } from './util';
import { toolInstallationEnvironment } from './goEnv';

export interface Tool {
name: string;
Expand Down Expand Up @@ -86,10 +87,14 @@ export function getImportPathWithVersion(
return importPath + '@' + version;
}
}
// staticcheck requires go1.17+ after v0.3.0.
// (golang/vscode-go#2162)
if (goVersion.lt('1.17') && tool.name === 'staticcheck') {
return importPath + '@v0.2.2';
if (tool.name === 'staticcheck') {
if (goVersion.lt('1.17')) return importPath + '@v0.2.2';
}
if (tool.name === 'gofumpt') {
if (goVersion.lt('1.18')) return importPath + '@v0.2.1';
}
if (tool.name === 'golangci-lint') {
if (goVersion.lt('1.18')) return importPath + '@v1.47.3';
}
return importPath + '@latest';
}
Expand Down

0 comments on commit 4f3a371

Please sign in to comment.