src/util.ts: log `go version` output

And, invoke the go version command in the tool execution environment.

Updates golang/vscode-go#166

Change-Id: I8e52035f2576af91ef7e987f7138805169d2c453
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/248858
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
diff --git a/src/util.ts b/src/util.ts
index 23b7f59..051f017 100644
--- a/src/util.ts
+++ b/src/util.ts
@@ -340,14 +340,18 @@
 		warn(`cached Go version (${JSON.stringify(cachedGoVersion)}) is invalid, recomputing`);
 	}
 	try {
+		const env = toolExecutionEnvironment();
 		const execFile = util.promisify(cp.execFile);
-		const { stdout, stderr } = await execFile(goRuntimePath, ['version']);
+		const { stdout, stderr } = await execFile(goRuntimePath, ['version'], {env});
 		if (stderr) {
 			warn(`failed to run "${goRuntimePath} version": stdout: ${stdout}, stderr: ${stderr}`);
 			return;
 		}
 		cachedGoBinPath = goRuntimePath;
 		cachedGoVersion = new GoVersion(goRuntimePath, stdout);
+		if (!cachedGoVersion.isValid()) {
+			warn (`unable to determine version from the output of "${goRuntimePath} version": "${stdout}"`);
+		}
 	} catch (err) {
 		warn(`failed to run "${goRuntimePath} version": ${err}`);
 		return;