mirror of
https://github.com/actions/setup-go.git
synced 2025-06-19 20:07:12 +02:00
format
This commit is contained in:
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user