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

Fixes #2122 tools are also found at GOBIN path #3001

Merged
Merged
Show file tree
Hide file tree
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
9 changes: 6 additions & 3 deletions src/goInstallTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,12 @@ export function installTools(missing: Tool[], goVersion: GoVersion): Promise<voi
return;
}

let installingMsg = `Installing ${missing.length} ${missing.length > 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,
Expand Down
6 changes: 6 additions & 0 deletions src/goPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down