Skip to content

Commit 4f3a371

Browse files
committed
src/goTools: specify gofumpt/golangci-lint versions for old go
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 <[email protected]> TryBot-Result: kokoro <[email protected]> Reviewed-by: Jamal Carvalho <[email protected]> Run-TryBot: Hyang-Ah Hana Kim <[email protected]>
1 parent fc6d532 commit 4f3a371

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/goTools.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { getFormatTool, usingCustomFormatTool } from './language/legacy/goFormat
1515
import { goLiveErrorsEnabled } from './language/legacy/goLiveErrors';
1616
import { allToolsInformation } from './goToolsInformation';
1717
import { getBinPath, GoVersion } from './util';
18+
import { toolInstallationEnvironment } from './goEnv';
1819

1920
export interface Tool {
2021
name: string;
@@ -86,10 +87,14 @@ export function getImportPathWithVersion(
8687
return importPath + '@' + version;
8788
}
8889
}
89-
// staticcheck requires go1.17+ after v0.3.0.
90-
// (golang/vscode-go#2162)
91-
if (goVersion.lt('1.17') && tool.name === 'staticcheck') {
92-
return importPath + '@v0.2.2';
90+
if (tool.name === 'staticcheck') {
91+
if (goVersion.lt('1.17')) return importPath + '@v0.2.2';
92+
}
93+
if (tool.name === 'gofumpt') {
94+
if (goVersion.lt('1.18')) return importPath + '@v0.2.1';
95+
}
96+
if (tool.name === 'golangci-lint') {
97+
if (goVersion.lt('1.18')) return importPath + '@v1.47.3';
9398
}
9499
return importPath + '@latest';
95100
}

0 commit comments

Comments
 (0)