Skip to content

Commit c7cf12e

Browse files
authored
Merge pull request #4 from dmitry-shibanov/v-dmshib/fix-test-for-aliases
Fix tests for aliases
2 parents ee675d7 + 3a18a01 commit c7cf12e

File tree

4 files changed

+29
-34
lines changed

4 files changed

+29
-34
lines changed

dist/setup/index.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63231,9 +63231,13 @@ function getGo(versionSpec, checkLatest, auth, arch = os_1.default.arch()) {
6323163231
return __awaiter(this, void 0, void 0, function* () {
6323263232
let manifest;
6323363233
let osPlat = os_1.default.platform();
63234+
if (versionSpec === utils_1.StableReleaseAlias.Stable ||
63235+
versionSpec === utils_1.StableReleaseAlias.OldStable) {
63236+
manifest = yield getManifest(auth);
63237+
versionSpec = yield resolveStableVersionInput(versionSpec, auth, arch, manifest);
63238+
}
6323463239
if (checkLatest) {
6323563240
core.info('Attempting to resolve the latest version from the manifest...');
63236-
manifest = yield getManifest(auth);
6323763241
const resolvedVersion = yield resolveVersionFromManifest(versionSpec, true, auth, arch, manifest);
6323863242
if (resolvedVersion) {
6323963243
versionSpec = resolvedVersion;
@@ -63243,11 +63247,6 @@ function getGo(versionSpec, checkLatest, auth, arch = os_1.default.arch()) {
6324363247
core.info(`Failed to resolve version ${versionSpec} from manifest`);
6324463248
}
6324563249
}
63246-
if (versionSpec === utils_1.StableReleaseAlias.Stable ||
63247-
versionSpec === utils_1.StableReleaseAlias.OldStable) {
63248-
manifest !== null && manifest !== void 0 ? manifest : (manifest = yield getManifest(auth));
63249-
versionSpec = yield resolveStableVersionInput(versionSpec, auth, arch, manifest);
63250-
}
6325163250
// check cache
6325263251
let toolPath;
6325363252
toolPath = tc.find('go', versionSpec, arch);
@@ -63263,7 +63262,7 @@ function getGo(versionSpec, checkLatest, auth, arch = os_1.default.arch()) {
6326363262
// Try download from internal distribution (popular versions only)
6326463263
//
6326563264
try {
63266-
info = yield getInfoFromManifest(versionSpec, true, auth, arch);
63265+
info = yield getInfoFromManifest(versionSpec, true, auth, arch, manifest);
6326763266
if (info) {
6326863267
downloadPath = yield installGoVersion(info, auth, arch);
6326963268
}

package-lock.json

Lines changed: 8 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"jest": "^27.2.5",
4141
"jest-circus": "^27.2.5",
4242
"nock": "^10.0.6",
43-
"prettier": "^2.8.0",
43+
"prettier": "^1.17.1",
4444
"ts-jest": "^27.0.5",
4545
"typescript": "^4.3.3"
4646
}

src/installer.ts

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,21 @@ export async function getGo(
3939
let manifest: tc.IToolRelease[] | undefined;
4040
let osPlat: string = os.platform();
4141

42+
if (
43+
versionSpec === StableReleaseAlias.Stable ||
44+
versionSpec === StableReleaseAlias.OldStable
45+
) {
46+
manifest = await getManifest(auth);
47+
versionSpec = await resolveStableVersionInput(
48+
versionSpec,
49+
auth,
50+
arch,
51+
manifest
52+
);
53+
}
54+
4255
if (checkLatest) {
4356
core.info('Attempting to resolve the latest version from the manifest...');
44-
manifest = await getManifest(auth);
4557
const resolvedVersion = await resolveVersionFromManifest(
4658
versionSpec,
4759
true,
@@ -57,19 +69,6 @@ export async function getGo(
5769
}
5870
}
5971

60-
if (
61-
versionSpec === StableReleaseAlias.Stable ||
62-
versionSpec === StableReleaseAlias.OldStable
63-
) {
64-
manifest ??= await getManifest(auth);
65-
versionSpec = await resolveStableVersionInput(
66-
versionSpec,
67-
auth,
68-
arch,
69-
manifest
70-
);
71-
}
72-
7372
// check cache
7473
let toolPath: string;
7574
toolPath = tc.find('go', versionSpec, arch);
@@ -86,7 +85,7 @@ export async function getGo(
8685
// Try download from internal distribution (popular versions only)
8786
//
8887
try {
89-
info = await getInfoFromManifest(versionSpec, true, auth, arch);
88+
info = await getInfoFromManifest(versionSpec, true, auth, arch, manifest);
9089
if (info) {
9190
downloadPath = await installGoVersion(info, auth, arch);
9291
} else {

0 commit comments

Comments
 (0)