src/goModules: exclude vendor paths from inferGopath disable mechanism

Go extension disables `go.inferGopath` when operating in the module-aware mode.
The extension heuristically determines whether it's in module-aware mode or not by
checking the presence of a `go.mod` file in the workspace. Vendored packages though
confuses this heuristics and can incorrectly conclude and disable the feature.
Exclude files from the vendor paths in this decision making.

Fixes golang/vscode-go#301

Change-Id: I20f711c34095eea95be74e97b4d270eb075053a3
GitHub-Last-Rev: 8bbeedd3b95856842912866fae3ce134b0a9f8e5
GitHub-Pull-Request: golang/vscode-go#754
Reviewed-by: Hyang-Ah Hana Kim <>
Trust: Hyang-Ah Hana Kim <>
Trust: Suzy Mueller <>
diff --git a/src/goModules.ts b/src/goModules.ts
index d958b70..ed11c1b 100644
--- a/src/goModules.ts
+++ b/src/goModules.ts
@@ -65,7 +65,7 @@
 		goModEnvResult = path.dirname(goModEnvResult);
 		const goConfig = getGoConfig(fileuri);
-		if (goConfig['inferGopath'] === true) {
+		if (goConfig['inferGopath'] === true && !fileuri.path.includes('/vendor/')) {
 			goConfig.update('inferGopath', false, vscode.ConfigurationTarget.WorkspaceFolder);
 				'The "inferGopath" setting is disabled for this workspace because Go modules are being used.'