minor fix

This commit is contained in:
Dmitry Shibanov 2022-12-08 22:10:41 +01:00
parent 11e0301e1d
commit 5a5cdc8151
2 changed files with 19 additions and 3 deletions

8
dist/setup/index.js vendored
View File

@ -63236,6 +63236,8 @@ function getGo(versionSpec, checkLatest, auth, arch = os_1.default.arch()) {
manifest = yield getManifest(auth);
let stableVersion = yield resolveStableVersionInput(versionSpec, arch, osPlat, manifest);
if (!stableVersion) {
let archFilter = sys.getArch(arch);
let platFilter = sys.getPlatform();
const dlUrl = 'https://golang.org/dl/?mode=json&include=all';
let candidates = yield module.exports.getVersionsDist(dlUrl);
if (!candidates) {
@ -63244,9 +63246,13 @@ function getGo(versionSpec, checkLatest, auth, arch = os_1.default.arch()) {
const fixedCandidates = candidates.map(item => {
return Object.assign(Object.assign({}, item), { version: makeSemver(item.version) });
});
stableVersion = yield resolveStableVersionInput(versionSpec, arch, osPlat, fixedCandidates);
stableVersion = yield resolveStableVersionInput(versionSpec, archFilter, platFilter, fixedCandidates);
if (!stableVersion) {
throw new Error(`Unable to find Go version '${versionSpec}' for platform ${osPlat} and architecture ${arch}.`);
}
}
versionSpec = stableVersion;
}
if (checkLatest) {
core.info('Attempting to resolve the latest version from the manifest...');
const resolvedVersion = yield resolveVersionFromManifest(versionSpec, true, auth, arch, manifest);

View File

@ -52,6 +52,8 @@ export async function getGo(
);
if (!stableVersion) {
let archFilter = sys.getArch(arch);
let platFilter = sys.getPlatform();
const dlUrl: string = 'https://golang.org/dl/?mode=json&include=all';
let candidates:
| IGoVersion[]
@ -69,13 +71,21 @@ export async function getGo(
stableVersion = await resolveStableVersionInput(
versionSpec,
arch,
osPlat,
archFilter,
platFilter,
fixedCandidates
);
if (!stableVersion) {
throw new Error(
`Unable to find Go version '${versionSpec}' for platform ${osPlat} and architecture ${arch}.`
);
}
}
versionSpec = stableVersion;
}
if (checkLatest) {
core.info('Attempting to resolve the latest version from the manifest...');
const resolvedVersion = await resolveVersionFromManifest(