refactor: enhance logging and group setup for Go version installation

pull/789/head
priyagupta108 2 weeks ago
parent fba3fb4ead
commit be69e2303e

@ -100576,12 +100576,14 @@ async function run() {
const versionSpec = resolveVersionInput(); const versionSpec = resolveVersionInput();
setGoToolchain(); setGoToolchain();
const cache = getBooleanInput('cache'); const cache = getBooleanInput('cache');
core_info(`Setup go version spec ${versionSpec}`);
let arch = getInput('architecture'); let arch = getInput('architecture');
if (!arch) { if (!arch) {
arch = external_os_default().arch(); arch = external_os_default().arch();
} }
if (versionSpec) { if (versionSpec) {
startGroup(`Setup Go ${versionSpec}`);
try {
core_info(`Setup go version spec ${versionSpec}`);
const token = getInput('token'); const token = getInput('token');
const auth = !token ? undefined : `token ${token}`; const auth = !token ? undefined : `token ${token}`;
const checkLatest = getBooleanInput('check-latest'); const checkLatest = getBooleanInput('check-latest');
@ -100603,6 +100605,10 @@ async function run() {
} }
core_info(`Successfully set up Go version ${versionSpec}`); core_info(`Successfully set up Go version ${versionSpec}`);
} }
finally {
endGroup();
}
}
else { else {
core_info('[warning]go-version input was not specified. The action will try to use pre-installed version.'); core_info('[warning]go-version input was not specified. The action will try to use pre-installed version.');
} }

@ -21,7 +21,6 @@ export async function run() {
setGoToolchain(); setGoToolchain();
const cache = core.getBooleanInput('cache'); const cache = core.getBooleanInput('cache');
core.info(`Setup go version spec ${versionSpec}`);
let arch = core.getInput('architecture') as Architecture; let arch = core.getInput('architecture') as Architecture;
@ -30,6 +29,10 @@ export async function run() {
} }
if (versionSpec) { if (versionSpec) {
core.startGroup(`Setup Go ${versionSpec}`);
try {
core.info(`Setup go version spec ${versionSpec}`);
const token = core.getInput('token'); const token = core.getInput('token');
const auth = !token ? undefined : `token ${token}`; const auth = !token ? undefined : `token ${token}`;
@ -65,6 +68,9 @@ export async function run() {
} }
core.info(`Successfully set up Go version ${versionSpec}`); core.info(`Successfully set up Go version ${versionSpec}`);
} finally {
core.endGroup();
}
} else { } else {
core.info( core.info(
'[warning]go-version input was not specified. The action will try to use pre-installed version.' '[warning]go-version input was not specified. The action will try to use pre-installed version.'

Loading…
Cancel
Save