Skip to content

Commit f8bce8c

Browse files
committed
src/goBuild: remove misleading error message in modules mode
As a workaround for microsoft/vscode-go#846 the build process tried to infer the import path. That does not apply in modules mode. The workaround is unnecessary and the error message is misleading. Do not print the error message if we are in modules mode. Change-Id: I9c081d774814d6ced5f49bad5af7dd8635e56984 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/254359 Reviewed-by: Suzy Mueller <[email protected]>
1 parent dcea773 commit f8bce8c

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/goBuild.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,17 @@ export async function goBuild(
146146

147147
outputChannel.appendLine(`Starting building the current package at ${cwd}`);
148148

149-
// Find the right importPath instead of directly using `.`. Fixes https://github.com/Microsoft/vscode-go/issues/846
150149
const currentGoWorkspace = getCurrentGoWorkspaceFromGOPATH(getCurrentGoPath(), cwd);
151150
let importPath = '.';
152-
if (currentGoWorkspace && !isMod) {
153-
importPath = cwd.substr(currentGoWorkspace.length + 1);
154-
} else {
155-
outputChannel.appendLine(
156-
`Not able to determine import path of current package by using cwd: ${cwd} and Go workspace: ${currentGoWorkspace}`
157-
);
151+
if (!isMod) {
152+
// Find the right importPath instead of directly using `.`. Fixes https://github.com/Microsoft/vscode-go/issues/846
153+
if (currentGoWorkspace && !isMod) {
154+
importPath = cwd.substr(currentGoWorkspace.length + 1);
155+
} else {
156+
outputChannel.appendLine(
157+
`Not able to determine import path of current package by using cwd: ${cwd} and Go workspace: ${currentGoWorkspace}`
158+
);
159+
}
158160
}
159161

160162
running = true;

0 commit comments

Comments
 (0)