mirror of
https://code.forgejo.org/actions/setup-go
synced 2025-06-10 12:32:23 +02:00
format
This commit is contained in:
parent
4282769cc0
commit
dc575ee3b3
7 changed files with 108 additions and 91 deletions
30
src/main.ts
30
src/main.ts
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue