src/goBuild: remove misleading error message in modules mode

As a workaround for https://github.com/microsoft/vscode-go/issues/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 <suzmue@golang.org>
diff --git a/src/goBuild.ts b/src/goBuild.ts
index 219a3e5..66ffb5e 100644
--- a/src/goBuild.ts
+++ b/src/goBuild.ts
@@ -146,15 +146,17 @@
 
 	outputChannel.appendLine(`Starting building the current package at ${cwd}`);
 
-	// Find the right importPath instead of directly using `.`. Fixes https://github.com/Microsoft/vscode-go/issues/846
 	const currentGoWorkspace = getCurrentGoWorkspaceFromGOPATH(getCurrentGoPath(), cwd);
 	let importPath = '.';
-	if (currentGoWorkspace && !isMod) {
-		importPath = cwd.substr(currentGoWorkspace.length + 1);
-	} else {
-		outputChannel.appendLine(
-			`Not able to determine import path of current package by using cwd: ${cwd} and Go workspace: ${currentGoWorkspace}`
-		);
+	if (!isMod) {
+		// Find the right importPath instead of directly using `.`. Fixes https://github.com/Microsoft/vscode-go/issues/846
+		if (currentGoWorkspace && !isMod) {
+			importPath = cwd.substr(currentGoWorkspace.length + 1);
+		} else {
+			outputChannel.appendLine(
+				`Not able to determine import path of current package by using cwd: ${cwd} and Go workspace: ${currentGoWorkspace}`
+			);
+		}
 	}
 
 	running = true;