Skip to content

Commit

Permalink
only needed to do once
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryan MacFarlane committed Mar 26, 2020
1 parent 4e8106c commit 262468e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
9 changes: 2 additions & 7 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1294,8 +1294,6 @@ function run() {
// since getting unstable versions should be explicit
let stable = (core.getInput('stable') || 'true').toUpperCase() === 'TRUE';
console.log(`Setup go ${stable ? 'stable' : ''} version spec ${versionSpec}`);
// if there's a globally install go and bin path, prefer that
let addedBin = addBinToPath();
if (versionSpec) {
let installDir = tc.find('go', versionSpec);
if (!installDir) {
Expand All @@ -1307,11 +1305,8 @@ function run() {
core.exportVariable('GOROOT', installDir);
core.addPath(path.join(installDir, 'bin'));
console.log('Added go to the path');
// if the global installed bin wasn't added,
// we can add the bin just installed
if (!addedBin) {
addBinToPath();
}
let added = addBinToPath();
core.debug(`add bin ${added}`);
}
else {
throw new Error(`Could not find a version that satisfied version spec: ${versionSpec}`);
Expand Down
9 changes: 2 additions & 7 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ export async function run() {
`Setup go ${stable ? 'stable' : ''} version spec ${versionSpec}`
);

// if there's a globally install go and bin path, prefer that
let addedBin = addBinToPath();
if (versionSpec) {
let installDir: string | undefined = tc.find('go', versionSpec);

Expand All @@ -40,11 +38,8 @@ export async function run() {
core.addPath(path.join(installDir, 'bin'));
console.log('Added go to the path');

// if the global installed bin wasn't added,
// we can add the bin just installed
if (!addedBin) {
addBinToPath();
}
let added = addBinToPath();
core.debug(`add bin ${added}`);
} else {
throw new Error(
`Could not find a version that satisfied version spec: ${versionSpec}`
Expand Down

0 comments on commit 262468e

Please sign in to comment.