Skip to content

Commit 322014f

Browse files
hyangahgopherbot
authored andcommitted
src/utils/pathUtils: adjust snap go path
A snapd issue prevents vscode-go (or node.js processes) from running the symlinked /snap/bin/go binary reliably. Use /snap/go/current/bin/go as suggested by users. Fixes golang/vscdoe-go#166 Change-Id: I2231b439ea5403fd748ed2dd982a26437483c63d Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/545915 Auto-Submit: Hyang-Ah Hana Kim <[email protected]> Reviewed-by: Alan Donovan <[email protected]> Commit-Queue: Hyang-Ah Hana Kim <[email protected]> Run-TryBot: Hyang-Ah Hana Kim <[email protected]> TryBot-Result: kokoro <[email protected]>
1 parent 4316a96 commit 322014f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/utils/pathUtils.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,14 @@ export function getBinPathWithPreferredGopathGorootWithExplanation(
102102
}
103103

104104
// Finally search PATH parts
105-
const pathFromPath = getBinPathFromEnvVar(binname, getEnvPath(), false);
105+
let pathFromPath = getBinPathFromEnvVar(binname, getEnvPath(), false);
106106
if (pathFromPath) {
107+
if (toolName === 'go' && pathFromPath === '/snap/bin/go') {
108+
// Workaround for the snapd issue (golang/vscode-go#166)
109+
// https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1849753
110+
console.log('using /snap/go/current/bin/go instead of /snap/bin/go (see golang/vscode-go#166)');
111+
pathFromPath = '/snap/go/current/bin/go';
112+
}
107113
binPathCache[toolName] = pathFromPath;
108114
return { binPath: pathFromPath, why: found('path') };
109115
}

0 commit comments

Comments
 (0)