1
0
Fork 0
mirror of https://code.forgejo.org/actions/setup-go synced 2025-06-10 12:32:23 +02:00
This commit is contained in:
Bryan MacFarlane 2020-02-09 00:29:21 -05:00
parent 4282769cc0
commit dc575ee3b3
7 changed files with 108 additions and 91 deletions

View file

@ -10,22 +10,24 @@ export async function run() {
// If not supplied then problem matchers will still be setup. Useful for self-hosted.
//
let versionSpec = core.getInput('go-version');
let stable: boolean = (core.getInput('stable') || '').toUpperCase() == "TRUE";
let stable: boolean =
(core.getInput('stable') || '').toUpperCase() == 'TRUE';
if (versionSpec) {
let installDir: string | undefined = tc.find('go', versionSpec);
let installDir: string | undefined = tc.find('go', versionSpec);
if (!installDir) {
installDir = await installer.downloadGo(versionSpec, stable);
}
if (installDir) {
core.exportVariable('GOROOT', installDir);
core.addPath(path.join(installDir, 'bin'));
}
else {
throw new Error(`Could not find a version that satisfied version spec: ${versionSpec}`);
}
if (!installDir) {
installDir = await installer.downloadGo(versionSpec, stable);
}
if (installDir) {
core.exportVariable('GOROOT', installDir);
core.addPath(path.join(installDir, 'bin'));
} else {
throw new Error(
`Could not find a version that satisfied version spec: ${versionSpec}`
);
}
}
// add problem matchers
@ -34,4 +36,4 @@ export async function run() {
} catch (error) {
core.setFailed(error.message);
}
}
}