diff --git a/src/goInstallTools.ts b/src/goInstallTools.ts index b1e095f15..93b42e9a1 100644 --- a/src/goInstallTools.ts +++ b/src/goInstallTools.ts @@ -144,9 +144,12 @@ export function installTools(missing: Tool[], goVersion: GoVersion): Promise 1 ? 'tools' : 'tool'} at ${toolsGopath}${ - path.sep - }bin`; + let installingMsg = `Installing ${missing.length} ${missing.length > 1 ? 'tools' : 'tool'} at `; + if (envForTools['GOBIN']) { + installingMsg += `the configured GOBIN: ${envForTools['GOBIN']}`; + } else { + installingMsg += toolsGopath + path.sep + 'bin'; + } // If the user is on Go >= 1.11, tools should be installed with modules enabled. // This ensures that users get the latest tagged version, rather than master, diff --git a/src/goPath.ts b/src/goPath.ts index caf40bbbb..cd89eeac0 100644 --- a/src/goPath.ts +++ b/src/goPath.ts @@ -41,6 +41,12 @@ export function getBinPathWithPreferredGopath(toolName: string, preferredGopaths } const binname = alternateTool && !path.isAbsolute(alternateTool) ? alternateTool : toolName; + const pathFromGoBin = getBinPathFromEnvVar(binname, process.env['GOBIN'], false); + if (pathFromGoBin) { + binPathCache[toolName] = pathFromGoBin; + return pathFromGoBin; + } + for (const preferred of preferredGopaths) { if (typeof preferred === 'string') { // Search in the preferred GOPATH workspace's bin folder