|
|
|
@ -100576,32 +100576,38 @@ 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) {
|
|
|
|
const token = getInput('token');
|
|
|
|
startGroup(`Setup Go ${versionSpec}`);
|
|
|
|
const auth = !token ? undefined : `token ${token}`;
|
|
|
|
try {
|
|
|
|
const checkLatest = getBooleanInput('check-latest');
|
|
|
|
core_info(`Setup go version spec ${versionSpec}`);
|
|
|
|
const goDownloadBaseUrl = getInput('go-download-base-url') ||
|
|
|
|
const token = getInput('token');
|
|
|
|
process.env['GO_DOWNLOAD_BASE_URL'] ||
|
|
|
|
const auth = !token ? undefined : `token ${token}`;
|
|
|
|
undefined;
|
|
|
|
const checkLatest = getBooleanInput('check-latest');
|
|
|
|
if (goDownloadBaseUrl) {
|
|
|
|
const goDownloadBaseUrl = getInput('go-download-base-url') ||
|
|
|
|
core_info(`Using custom Go download base URL: ${goDownloadBaseUrl}`);
|
|
|
|
process.env['GO_DOWNLOAD_BASE_URL'] ||
|
|
|
|
}
|
|
|
|
undefined;
|
|
|
|
const installDir = await getGo(versionSpec, checkLatest, auth, arch, goDownloadBaseUrl);
|
|
|
|
if (goDownloadBaseUrl) {
|
|
|
|
const installDirVersion = external_path_default().basename(external_path_default().dirname(installDir));
|
|
|
|
core_info(`Using custom Go download base URL: ${goDownloadBaseUrl}`);
|
|
|
|
addPath(external_path_default().join(installDir, 'bin'));
|
|
|
|
}
|
|
|
|
core_info('Added go to the path');
|
|
|
|
const installDir = await getGo(versionSpec, checkLatest, auth, arch, goDownloadBaseUrl);
|
|
|
|
const version = makeSemver(installDirVersion);
|
|
|
|
const installDirVersion = external_path_default().basename(external_path_default().dirname(installDir));
|
|
|
|
// Go versions less than 1.9 require GOROOT to be set
|
|
|
|
addPath(external_path_default().join(installDir, 'bin'));
|
|
|
|
if (node_modules_semver.lt(version, '1.9.0')) {
|
|
|
|
core_info('Added go to the path');
|
|
|
|
core_info('Setting GOROOT for Go version < 1.9');
|
|
|
|
const version = makeSemver(installDirVersion);
|
|
|
|
exportVariable('GOROOT', installDir);
|
|
|
|
// Go versions less than 1.9 require GOROOT to be set
|
|
|
|
}
|
|
|
|
if (node_modules_semver.lt(version, '1.9.0')) {
|
|
|
|
core_info(`Successfully set up Go version ${versionSpec}`);
|
|
|
|
core_info('Setting GOROOT for Go version < 1.9');
|
|
|
|
|
|
|
|
exportVariable('GOROOT', installDir);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
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.');
|
|
|
|
|