Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Fixes #592 Use go from GOROOT while installing tools #594

Merged
merged 1 commit into from
Nov 1, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/goInstallTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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);
}
Expand All @@ -110,7 +111,7 @@ function installTools(goVersion: SemVersion, missing?: string[]) {

missing.reduce((res: Promise<string[]>, tool: string) => {
return res.then(sofar => new Promise<string[]>((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();
Expand Down