[vscode-go] src/goTools: explicitly specify staticcheck, gotests package paths

1 view
Skip to first unread message

Hyang-Ah Hana Kim (Gerrit)

unread,
Mar 10, 2021, 12:12:49 PM3/10/21
to Hyang-Ah Hana Kim, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Suzy Mueller, kokoro, golang-co...@googlegroups.com

Hyang-Ah Hana Kim submitted this change.

View Change

Approvals: Suzy Mueller: Looks good to me, approved Hyang-Ah Hana Kim: Trusted; Run TryBots kokoro: TryBots succeeded
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 <hya...@gmail.com>
Run-TryBot: Hyang-Ah Hana Kim <hya...@gmail.com>
TryBot-Result: kokoro <noreply...@google.com>
Reviewed-by: Suzy Mueller <suz...@golang.org>
---
M src/goInstallTools.ts
M src/goTools.ts
2 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/src/goInstallTools.ts b/src/goInstallTools.ts
index b53cb08..f59f2b3 100644
--- a/src/goInstallTools.ts
+++ b/src/goInstallTools.ts
@@ -21,7 +21,6 @@
import { addGoStatus, initGoStatusBar, outputChannel, removeGoStatus } from './goStatus';
import {
containsTool,
- disableModulesForWildcard,
getConfiguredTools,
getImportPath,
getImportPathWithVersion,
@@ -158,8 +157,7 @@

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

const reason = installTool(tool, goVersion, envForTools, !modulesOffForTool);
toInstall.push(Promise.resolve({ tool, reason: await reason }));
diff --git a/src/goTools.ts b/src/goTools.ts
index a4ec994..b0bf7b3 100644
--- a/src/goTools.ts
+++ b/src/goTools.ts
@@ -68,19 +68,6 @@
}
return importPath;
}
-/**
- * Returns boolean denoting if the import path for the given tool ends with `/...`
- * and if the version of Go supports installing wildcard paths in module mode.
- * @param tool Object of type `Tool` for the Go tool.
- * @param goVersion The current Go version.
- */
-export function disableModulesForWildcard(tool: Tool, goVersion: GoVersion): boolean {
- const importPath = getImportPath(tool, goVersion);
- const isWildcard = importPath.endsWith('...');
-
- // Only Go >= 1.13 supports installing wildcards in module mode.
- return isWildcard && goVersion.lt('1.13');
-}

export function containsTool(tools: Tool[], tool: Tool): boolean {
return tools.indexOf(tool) > -1;
@@ -332,7 +319,7 @@
},
'gotests': {
name: 'gotests',
- importPath: 'github.com/cweill/gotests/...',
+ importPath: 'github.com/cweill/gotests/gotests',
replacedByGopls: false,
isImportant: false,
description: 'Generate unit tests',
@@ -349,7 +336,7 @@
},
'staticcheck': {
name: 'staticcheck',
- importPath: 'honnef.co/go/tools/...',
+ importPath: 'honnef.co/go/tools/cmd/staticcheck',
replacedByGopls: false,
isImportant: true,
description: 'Linter'

To view, visit change 300390. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: vscode-go
Gerrit-Branch: master
Gerrit-Change-Id: Ibb91ef51df697d5320cb73462d501ef21f7ac9a0
Gerrit-Change-Number: 300390
Gerrit-PatchSet: 2
Gerrit-Owner: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Hyang-Ah Hana Kim <hya...@gmail.com>
Gerrit-Reviewer: Suzy Mueller <suz...@golang.org>
Gerrit-Reviewer: kokoro <noreply...@google.com>
Gerrit-MessageType: merged
Reply all
Reply to author
Forward
0 new messages