mirror of
https://code.forgejo.org/actions/setup-go.git
synced 2024-11-05 19:45:49 +00:00
only needed to do once
This commit is contained in:
parent
4e8106ca18
commit
262468e92f
2 changed files with 4 additions and 14 deletions
9
dist/index.js
vendored
9
dist/index.js
vendored
|
@ -1294,8 +1294,6 @@ function run() {
|
||||||
// since getting unstable versions should be explicit
|
// since getting unstable versions should be explicit
|
||||||
let stable = (core.getInput('stable') || 'true').toUpperCase() === 'TRUE';
|
let stable = (core.getInput('stable') || 'true').toUpperCase() === 'TRUE';
|
||||||
console.log(`Setup go ${stable ? 'stable' : ''} version spec ${versionSpec}`);
|
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) {
|
if (versionSpec) {
|
||||||
let installDir = tc.find('go', versionSpec);
|
let installDir = tc.find('go', versionSpec);
|
||||||
if (!installDir) {
|
if (!installDir) {
|
||||||
|
@ -1307,11 +1305,8 @@ function run() {
|
||||||
core.exportVariable('GOROOT', installDir);
|
core.exportVariable('GOROOT', installDir);
|
||||||
core.addPath(path.join(installDir, 'bin'));
|
core.addPath(path.join(installDir, 'bin'));
|
||||||
console.log('Added go to the path');
|
console.log('Added go to the path');
|
||||||
// if the global installed bin wasn't added,
|
let added = addBinToPath();
|
||||||
// we can add the bin just installed
|
core.debug(`add bin ${added}`);
|
||||||
if (!addedBin) {
|
|
||||||
addBinToPath();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new Error(`Could not find a version that satisfied version spec: ${versionSpec}`);
|
throw new Error(`Could not find a version that satisfied version spec: ${versionSpec}`);
|
||||||
|
|
|
@ -22,8 +22,6 @@ export async function run() {
|
||||||
`Setup go ${stable ? 'stable' : ''} version spec ${versionSpec}`
|
`Setup go ${stable ? 'stable' : ''} version spec ${versionSpec}`
|
||||||
);
|
);
|
||||||
|
|
||||||
// if there's a globally install go and bin path, prefer that
|
|
||||||
let addedBin = addBinToPath();
|
|
||||||
if (versionSpec) {
|
if (versionSpec) {
|
||||||
let installDir: string | undefined = tc.find('go', versionSpec);
|
let installDir: string | undefined = tc.find('go', versionSpec);
|
||||||
|
|
||||||
|
@ -40,11 +38,8 @@ export async function run() {
|
||||||
core.addPath(path.join(installDir, 'bin'));
|
core.addPath(path.join(installDir, 'bin'));
|
||||||
console.log('Added go to the path');
|
console.log('Added go to the path');
|
||||||
|
|
||||||
// if the global installed bin wasn't added,
|
let added = addBinToPath();
|
||||||
// we can add the bin just installed
|
core.debug(`add bin ${added}`);
|
||||||
if (!addedBin) {
|
|
||||||
addBinToPath();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Could not find a version that satisfied version spec: ${versionSpec}`
|
`Could not find a version that satisfied version spec: ${versionSpec}`
|
||||||
|
|
Loading…
Reference in a new issue