Skip to content

Commit 977bb74

Browse files
committed
src/goTools: explicitly specify staticcheck, gotests package paths
Remove disableModulesForWildcard. We will not use wildcard import paths for tools installation. Change-Id: Ibb91ef51df697d5320cb73462d501ef21f7ac9a0 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/300390 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: Suzy Mueller <suzmue@golang.org>
1 parent ace0cf7 commit 977bb74

File tree

2 files changed

+3
-18
lines changed

2 files changed

+3
-18
lines changed

src/goInstallTools.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import { restartLanguageServer } from './goMain';
2121
import { addGoStatus, initGoStatusBar, outputChannel, removeGoStatus } from './goStatus';
2222
import {
2323
containsTool,
24-
disableModulesForWildcard,
2524
getConfiguredTools,
2625
getImportPath,
2726
getImportPathWithVersion,
@@ -158,8 +157,7 @@ export async function installTools(
158157

159158
const toInstall: Promise<{ tool: Tool; reason: string }>[] = [];
160159
for (const tool of missing) {
161-
// Disable modules for tools which are installed with the "..." wildcard.
162-
const modulesOffForTool = modulesOff || disableModulesForWildcard(tool, goVersion);
160+
const modulesOffForTool = modulesOff;
163161

164162
const reason = installTool(tool, goVersion, envForTools, !modulesOffForTool);
165163
toInstall.push(Promise.resolve({ tool, reason: await reason }));

src/goTools.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,6 @@ export function getImportPathWithVersion(tool: Tool, version: semver.SemVer, goV
6868
}
6969
return importPath;
7070
}
71-
/**
72-
* Returns boolean denoting if the import path for the given tool ends with `/...`
73-
* and if the version of Go supports installing wildcard paths in module mode.
74-
* @param tool Object of type `Tool` for the Go tool.
75-
* @param goVersion The current Go version.
76-
*/
77-
export function disableModulesForWildcard(tool: Tool, goVersion: GoVersion): boolean {
78-
const importPath = getImportPath(tool, goVersion);
79-
const isWildcard = importPath.endsWith('...');
80-
81-
// Only Go >= 1.13 supports installing wildcards in module mode.
82-
return isWildcard && goVersion.lt('1.13');
83-
}
8471

8572
export function containsTool(tools: Tool[], tool: Tool): boolean {
8673
return tools.indexOf(tool) > -1;
@@ -332,7 +319,7 @@ export const allToolsInformation: { [key: string]: Tool } = {
332319
},
333320
'gotests': {
334321
name: 'gotests',
335-
importPath: 'github.com/cweill/gotests/...',
322+
importPath: 'github.com/cweill/gotests/gotests',
336323
replacedByGopls: false,
337324
isImportant: false,
338325
description: 'Generate unit tests',
@@ -349,7 +336,7 @@ export const allToolsInformation: { [key: string]: Tool } = {
349336
},
350337
'staticcheck': {
351338
name: 'staticcheck',
352-
importPath: 'honnef.co/go/tools/...',
339+
importPath: 'honnef.co/go/tools/cmd/staticcheck',
353340
replacedByGopls: false,
354341
isImportant: true,
355342
description: 'Linter'

0 commit comments

Comments
 (0)