Skip to content

Commit 9fbc767

Browse files
authored
Merge pull request actions#30 from hross/master
Change getFileName to do architecture lookups and add arm support
2 parents 75259a5 + 0cbaec8 commit 9fbc767

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

lib/installer.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ function acquireGo(version) {
7272
//
7373
let fileName = getFileName(version);
7474
let downloadUrl = getDownloadUrl(fileName);
75+
core.debug('Downloading Go from: ' + downloadUrl);
7576
let downloadPath = null;
7677
try {
7778
downloadPath = yield tc.downloadTool(downloadUrl);
@@ -102,8 +103,14 @@ function acquireGo(version) {
102103
});
103104
}
104105
function getFileName(version) {
106+
const arches = {
107+
x64: 'amd64',
108+
arm: 'armv6l',
109+
arm64: 'arm64',
110+
default: '386'
111+
};
105112
const platform = osPlat == 'win32' ? 'windows' : osPlat;
106-
const arch = osArch == 'x64' ? 'amd64' : '386';
113+
const arch = arches[osArch] || arches['default'];
107114
const ext = osPlat == 'win32' ? 'zip' : 'tar.gz';
108115
const filename = util.format('go%s.%s-%s.%s', version, platform, arch, ext);
109116
return filename;

src/installer.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ async function acquireGo(version: string): Promise<string> {
5757
//
5858
let fileName: string = getFileName(version);
5959
let downloadUrl: string = getDownloadUrl(fileName);
60+
61+
core.debug('Downloading Go from: ' + downloadUrl);
62+
6063
let downloadPath: string | null = null;
6164
try {
6265
downloadPath = await tc.downloadTool(downloadUrl);
@@ -89,8 +92,15 @@ async function acquireGo(version: string): Promise<string> {
8992
}
9093

9194
function getFileName(version: string): string {
95+
const arches: {[arch: string]: string} = {
96+
x64: 'amd64',
97+
arm: 'armv6l',
98+
arm64: 'arm64',
99+
default: '386'
100+
};
101+
92102
const platform: string = osPlat == 'win32' ? 'windows' : osPlat;
93-
const arch: string = osArch == 'x64' ? 'amd64' : '386';
103+
const arch: string = arches[osArch] || arches['default'];
94104
const ext: string = osPlat == 'win32' ? 'zip' : 'tar.gz';
95105
const filename: string = util.format(
96106
'go%s.%s-%s.%s',
@@ -99,6 +109,7 @@ function getFileName(version: string): string {
99109
arch,
100110
ext
101111
);
112+
102113
return filename;
103114
}
104115

0 commit comments

Comments
 (0)