better user output

This commit is contained in:
Bryan MacFarlane
2020-02-09 22:39:44 -05:00
parent 6b10398c43
commit a6a701e18e
3 changed files with 18 additions and 0 deletions

View File

@ -18,10 +18,13 @@ export async function downloadGo(
// download
debug(`match ${match.version}`);
let downloadUrl: string = `https://storage.googleapis.com/golang/${match.files[0].filename}`;
console.log(`Downloading from ${downloadUrl}`);
let downloadPath: string = await tc.downloadTool(downloadUrl);
debug(`downloaded to ${downloadPath}`);
// extract
console.log('Extracting ...');
let extPath: string =
sys.getPlatform() == 'windows'
? await tc.extractZip(downloadPath)

View File

@ -15,16 +15,25 @@ export async function run() {
// since getting unstable versions should be explicit
let stable = Boolean(core.getInput('stable') || 'true');
console.log(
`Setup go ${stable ? 'stable' : ''} version spec ${versionSpec}`
);
if (versionSpec) {
let installDir: string | undefined = tc.find('go', versionSpec);
if (!installDir) {
console.log(
`A version satisfying ${versionSpec} not found locally, attempting to download ...`
);
installDir = await installer.downloadGo(versionSpec, stable);
console.log('installed');
}
if (installDir) {
core.exportVariable('GOROOT', installDir);
core.addPath(path.join(installDir, 'bin'));
console.log('added to the path');
} else {
throw new Error(
`Could not find a version that satisfied version spec: ${versionSpec}`