From 93cf84c15c48867d5fbf0050a43880b20a4149db Mon Sep 17 00:00:00 2001 From: panticmilos Date: Mon, 8 Aug 2022 14:13:08 +0200 Subject: [PATCH] Fix arch conversion --- dist/setup/index.js | 18 ++++++------------ src/installer.ts | 13 ++----------- src/system.ts | 6 ++++-- 3 files changed, 12 insertions(+), 25 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 1d12b40..dfbf3b3 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -63005,9 +63005,9 @@ function getInfoFromDist(versionSpec, arch) { }; }); } -function findMatch(versionSpec, arch = sys.getArch()) { +function findMatch(versionSpec, arch = os_1.default.arch()) { return __awaiter(this, void 0, void 0, function* () { - let archFilter = translateArchToDistUrl(arch); + let archFilter = sys.getArch(arch); let platFilter = sys.getPlatform(); let result; let match; @@ -63087,14 +63087,6 @@ function parseGoVersionFile(versionFilePath) { return contents.trim(); } exports.parseGoVersionFile = parseGoVersionFile; -function translateArchToDistUrl(arch) { - switch (arch) { - case 'arm': - return 'armv6l'; - default: - return arch; - } -} /***/ }), @@ -63293,9 +63285,8 @@ function getPlatform() { return plat; } exports.getPlatform = getPlatform; -function getArch() { +function getArch(arch) { // 'arm', 'arm64', 'ia32', 'mips', 'mipsel', 'ppc', 'ppc64', 's390', 's390x', 'x32', and 'x64'. - let arch = os.arch(); // wants amd64, 386, arm64, armv61, ppc641e, s390x // currently not supported by runner but future proofed mapping switch (arch) { @@ -63308,6 +63299,9 @@ function getArch() { case 'x32': arch = '386'; break; + case 'arm': + arch = 'armv6l'; + break; } return arch; } diff --git a/src/installer.ts b/src/installer.ts index 58e33db..112ba46 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -223,9 +223,9 @@ async function getInfoFromDist( export async function findMatch( versionSpec: string, - arch = sys.getArch() + arch = os.arch() ): Promise { - let archFilter = translateArchToDistUrl(arch); + let archFilter = sys.getArch(arch); let platFilter = sys.getPlatform(); let result: IGoVersion | undefined; @@ -323,12 +323,3 @@ export function parseGoVersionFile(versionFilePath: string): string { return contents.trim(); } - -function translateArchToDistUrl(arch: string): string { - switch (arch) { - case 'arm': - return 'armv6l'; - default: - return arch; - } -} diff --git a/src/system.ts b/src/system.ts index 6973f99..3164a21 100644 --- a/src/system.ts +++ b/src/system.ts @@ -15,9 +15,8 @@ export function getPlatform(): string { return plat; } -export function getArch(): string { +export function getArch(arch: string): string { // 'arm', 'arm64', 'ia32', 'mips', 'mipsel', 'ppc', 'ppc64', 's390', 's390x', 'x32', and 'x64'. - let arch: string = os.arch(); // wants amd64, 386, arm64, armv61, ppc641e, s390x // currently not supported by runner but future proofed mapping @@ -31,6 +30,9 @@ export function getArch(): string { case 'x32': arch = '386'; break; + case 'arm': + arch = 'armv6l'; + break; } return arch;