Skip to content

Commit cbb1479

Browse files
committed
src/goModules: check goVersion isn't null before using it
Added similar check in goVet - but in such case, the vet will fail later in runTools. Fixes #1251 Change-Id: I226a107606e5633584ff1e337efa5762d245099a Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/297132 Trust: Hyang-Ah Hana Kim <[email protected]> Run-TryBot: Hyang-Ah Hana Kim <[email protected]> TryBot-Result: kokoro <[email protected]> Reviewed-by: Rebecca Stambler <[email protected]>
1 parent 6c0bda2 commit cbb1479

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/goModules.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export async function getModFolderPath(fileuri: vscode.Uri, isDir?: boolean): Pr
5858
return moduleCache;
5959
}
6060
const goVersion = await getGoVersion();
61-
if (goVersion.lt('1.11')) {
61+
if (!goVersion || goVersion.lt('1.11')) {
6262
return;
6363
}
6464

src/goVet.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export async function goVet(
105105
}
106106

107107
let vetArgs = ['vet', ...args, ...tagsArg, vetWorkspace ? './...' : '.'];
108-
if (goVersion.lt('1.10') && args.length) {
108+
if (goVersion && goVersion.lt('1.10') && args.length) {
109109
vetArgs = ['tool', 'vet', ...args, ...tagsArg, '.'];
110110
}
111111

0 commit comments

Comments
 (0)