From 9174b4d519e3ae0d6e2da482b4766d1f34e665c5 Mon Sep 17 00:00:00 2001 From: Ramya Rao Date: Tue, 1 Nov 2016 14:43:16 -0700 Subject: [PATCH] Fixes #592 Use Go from GOROOT while installing tools (#594) --- src/goInstallTools.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/goInstallTools.ts b/src/goInstallTools.ts index cbf44ecde..e7bca03f1 100644 --- a/src/goInstallTools.ts +++ b/src/goInstallTools.ts @@ -11,7 +11,7 @@ import path = require('path'); import os = require('os'); import cp = require('child_process'); import { showGoStatus, hideGoStatus } from './goStatus'; -import { getBinPath } from './goPath'; +import { getBinPath, getGoRuntimePath } from './goPath'; import { outputChannel } from './goStatus'; import { getGoVersion, SemVersion, isVendorSupported } from './util'; @@ -96,6 +96,7 @@ export function promptForUpdatingTool(tool: string) { */ function installTools(goVersion: SemVersion, missing?: string[]) { let tools = getTools(goVersion); + let goRuntimePath = getGoRuntimePath(); if (!missing) { missing = Object.keys(tools); } @@ -110,7 +111,7 @@ function installTools(goVersion: SemVersion, missing?: string[]) { missing.reduce((res: Promise, tool: string) => { return res.then(sofar => new Promise((resolve, reject) => { - cp.exec('go get -u -v ' + tools[tool], { env: process.env }, (err, stdout, stderr) => { + cp.execFile(goRuntimePath, ['get', '-u', '-v', tools[tool]], { env: process.env }, (err, stdout, stderr) => { if (err) { outputChannel.appendLine('Installing ' + tool + ' FAILED'); let failureReason = tool + ';;' + err + stdout.toString() + stderr.toString();