Skip to content

Commit c17c69f

Browse files
zppratthyangah
authored andcommitted
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 #301 Change-Id: I20f711c34095eea95be74e97b4d270eb075053a3 GitHub-Last-Rev: 8bbeedd GitHub-Pull-Request: #754 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/260658 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com> Trust: Hyang-Ah Hana Kim <hyangah@gmail.com> Trust: Suzy Mueller <suzmue@golang.org>
1 parent 0cdccf1 commit c17c69f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/goModules.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export async function getModFolderPath(fileuri: vscode.Uri, isDir?: boolean): Pr
6565
goModEnvResult = path.dirname(goModEnvResult);
6666
const goConfig = getGoConfig(fileuri);
6767

68-
if (goConfig['inferGopath'] === true) {
68+
if (goConfig['inferGopath'] === true && !fileuri.path.includes('/vendor/')) {
6969
goConfig.update('inferGopath', false, vscode.ConfigurationTarget.WorkspaceFolder);
7070
vscode.window.showInformationMessage(
7171
'The "inferGopath" setting is disabled for this workspace because Go modules are being used.'

0 commit comments

Comments
 (0)