Skip to content

Commit

Permalink
Merge pull request #4 from dmitry-shibanov/v-dmshib/fix-test-for-aliases
Browse files Browse the repository at this point in the history
Fix tests for aliases
  • Loading branch information
panticmilos authored Dec 6, 2022
2 parents ee675d7 + 3a18a01 commit c7cf12e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 34 deletions.
13 changes: 6 additions & 7 deletions dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63231,9 +63231,13 @@ function getGo(versionSpec, checkLatest, auth, arch = os_1.default.arch()) {
return __awaiter(this, void 0, void 0, function* () {
let manifest;
let osPlat = os_1.default.platform();
if (versionSpec === utils_1.StableReleaseAlias.Stable ||
versionSpec === utils_1.StableReleaseAlias.OldStable) {
manifest = yield getManifest(auth);
versionSpec = yield resolveStableVersionInput(versionSpec, auth, arch, manifest);
}
if (checkLatest) {
core.info('Attempting to resolve the latest version from the manifest...');
manifest = yield getManifest(auth);
const resolvedVersion = yield resolveVersionFromManifest(versionSpec, true, auth, arch, manifest);
if (resolvedVersion) {
versionSpec = resolvedVersion;
Expand All @@ -63243,11 +63247,6 @@ function getGo(versionSpec, checkLatest, auth, arch = os_1.default.arch()) {
core.info(`Failed to resolve version ${versionSpec} from manifest`);
}
}
if (versionSpec === utils_1.StableReleaseAlias.Stable ||
versionSpec === utils_1.StableReleaseAlias.OldStable) {
manifest !== null && manifest !== void 0 ? manifest : (manifest = yield getManifest(auth));
versionSpec = yield resolveStableVersionInput(versionSpec, auth, arch, manifest);
}
// check cache
let toolPath;
toolPath = tc.find('go', versionSpec, arch);
Expand All @@ -63263,7 +63262,7 @@ function getGo(versionSpec, checkLatest, auth, arch = os_1.default.arch()) {
// Try download from internal distribution (popular versions only)
//
try {
info = yield getInfoFromManifest(versionSpec, true, auth, arch);
info = yield getInfoFromManifest(versionSpec, true, auth, arch, manifest);
if (info) {
downloadPath = yield installGoVersion(info, auth, arch);
}
Expand Down
19 changes: 8 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"jest": "^27.2.5",
"jest-circus": "^27.2.5",
"nock": "^10.0.6",
"prettier": "^2.8.0",
"prettier": "^1.17.1",
"ts-jest": "^27.0.5",
"typescript": "^4.3.3"
}
Expand Down
29 changes: 14 additions & 15 deletions src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,21 @@ export async function getGo(
let manifest: tc.IToolRelease[] | undefined;
let osPlat: string = os.platform();

if (
versionSpec === StableReleaseAlias.Stable ||
versionSpec === StableReleaseAlias.OldStable
) {
manifest = await getManifest(auth);
versionSpec = await resolveStableVersionInput(
versionSpec,
auth,
arch,
manifest
);
}

if (checkLatest) {
core.info('Attempting to resolve the latest version from the manifest...');
manifest = await getManifest(auth);
const resolvedVersion = await resolveVersionFromManifest(
versionSpec,
true,
Expand All @@ -57,19 +69,6 @@ export async function getGo(
}
}

if (
versionSpec === StableReleaseAlias.Stable ||
versionSpec === StableReleaseAlias.OldStable
) {
manifest ??= await getManifest(auth);
versionSpec = await resolveStableVersionInput(
versionSpec,
auth,
arch,
manifest
);
}

// check cache
let toolPath: string;
toolPath = tc.find('go', versionSpec, arch);
Expand All @@ -86,7 +85,7 @@ export async function getGo(
// Try download from internal distribution (popular versions only)
//
try {
info = await getInfoFromManifest(versionSpec, true, auth, arch);
info = await getInfoFromManifest(versionSpec, true, auth, arch, manifest);
if (info) {
downloadPath = await installGoVersion(info, auth, arch);
} else {
Expand Down

0 comments on commit c7cf12e

Please sign in to comment.