mirror of
https://github.com/actions/setup-go.git
synced 2025-11-07 04:26:55 +00:00
Compare commits
4 commits
30cfff9df3
...
f876d39c24
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f876d39c24 | ||
|
|
faf52423ec | ||
|
|
7bc60db215 | ||
|
|
f89ad3b87c |
9 changed files with 108 additions and 28 deletions
40
.github/workflows/versions.yml
vendored
40
.github/workflows/versions.yml
vendored
|
|
@ -18,7 +18,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- name: Setup Go Stable
|
- name: Setup Go Stable
|
||||||
|
|
@ -33,7 +33,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- name: Setup Go oldStable
|
- name: Setup Go oldStable
|
||||||
|
|
@ -48,13 +48,13 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||||
version: [stable, oldstable]
|
version: [stable, oldstable]
|
||||||
architecture: [x64, x32]
|
architecture: [x64, x32]
|
||||||
exclude:
|
exclude:
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
architecture: x32
|
architecture: x32
|
||||||
- os: macos-13
|
- os: macos-latest-large
|
||||||
architecture: x32
|
architecture: x32
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
|
|
@ -72,7 +72,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-latest, windows-latest, ubuntu-latest, macos-13]
|
os: [macos-latest, windows-latest, ubuntu-latest, macos-latest-large]
|
||||||
go: [1.21.13, 1.22.8, 1.23.2]
|
go: [1.21.13, 1.22.8, 1.23.2]
|
||||||
include:
|
include:
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
|
|
@ -98,7 +98,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||||
go-version: ['1.20', '1.21', '1.22', '1.23']
|
go-version: ['1.20', '1.21', '1.22', '1.23']
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
|
|
@ -115,7 +115,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- name: Setup Go and check latest
|
- name: Setup Go and check latest
|
||||||
|
|
@ -131,7 +131,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- name: Setup Go and check latest
|
- name: Setup Go and check latest
|
||||||
|
|
@ -142,12 +142,28 @@ jobs:
|
||||||
run: __tests__/verify-go.sh 1.21
|
run: __tests__/verify-go.sh 1.21
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
|
go-version-file-with-tool-versions:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v5
|
||||||
|
- name: Setup Go and check latest
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
go-version-file: __tests__/data/.tool-versions
|
||||||
|
- name: verify go
|
||||||
|
run: __tests__/verify-go.sh 1.23.2
|
||||||
|
shell: bash
|
||||||
|
|
||||||
setup-versions-from-manifest:
|
setup-versions-from-manifest:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-latest, windows-latest, ubuntu-latest, macos-13]
|
os: [macos-latest, windows-latest, ubuntu-latest, macos-latest-large]
|
||||||
go: [1.20.14, 1.21.10, 1.22.8, 1.23.2]
|
go: [1.20.14, 1.21.10, 1.22.8, 1.23.2]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|
@ -167,7 +183,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [windows-latest, ubuntu-latest, macos-13]
|
os: [windows-latest, ubuntu-latest, macos-latest-large]
|
||||||
go: [1.11.12]
|
go: [1.11.12]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
|
@ -187,7 +203,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||||
go-version: [1.20.14, 1.21, 1.22, 1.23]
|
go-version: [1.20.14, 1.21, 1.22, 1.23]
|
||||||
include:
|
include:
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
|
|
@ -196,7 +212,7 @@ jobs:
|
||||||
architecture: x64
|
architecture: x64
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
architecture: x64
|
architecture: x64
|
||||||
- os: macos-13
|
- os: macos-latest-large
|
||||||
architecture: x64
|
architecture: x64
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
|
|
|
||||||
15
README.md
15
README.md
|
|
@ -27,7 +27,7 @@ See full release notes on the [releases page](https://github.com/actions/setup-g
|
||||||
The action will first check the local cache for a version match. If a version is not found locally, it will pull it from
|
The action will first check the local cache for a version match. If a version is not found locally, it will pull it from
|
||||||
the `main` branch of the [go-versions](https://github.com/actions/go-versions/blob/main/versions-manifest.json)
|
the `main` branch of the [go-versions](https://github.com/actions/go-versions/blob/main/versions-manifest.json)
|
||||||
repository. On miss or failure, it will fall back to downloading directly
|
repository. On miss or failure, it will fall back to downloading directly
|
||||||
from [go dist](https://storage.googleapis.com/golang). To change the default behavior, please use
|
from [go dist](https://go.dev/dl). To change the default behavior, please use
|
||||||
the [check-latest input](#check-latest-version).
|
the [check-latest input](#check-latest-version).
|
||||||
|
|
||||||
**Note:** The `setup-go` action uses executable binaries which are built by Golang side. The action does not build
|
**Note:** The `setup-go` action uses executable binaries which are built by Golang side. The action does not build
|
||||||
|
|
@ -178,7 +178,7 @@ steps:
|
||||||
|
|
||||||
## Getting go version from the go.mod file
|
## Getting go version from the go.mod file
|
||||||
|
|
||||||
The `go-version-file` input accepts a path to a `go.mod` file or a `go.work`
|
The `go-version-file` input accepts a path to a `go.mod` file, `.tool-versions` file or a `go.work`
|
||||||
file that contains the version of Go to be used by a project. The version taken
|
file that contains the version of Go to be used by a project. The version taken
|
||||||
from thils file will be:
|
from thils file will be:
|
||||||
|
|
||||||
|
|
@ -203,6 +203,15 @@ steps:
|
||||||
go-version-file: 'path/to/go.mod'
|
go-version-file: 'path/to/go.mod'
|
||||||
- run: go version
|
- run: go version
|
||||||
```
|
```
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v5
|
||||||
|
- uses: actions/setup-go@v6
|
||||||
|
with:
|
||||||
|
go-version-file: '.tool-versions'
|
||||||
|
- run: go version
|
||||||
|
```
|
||||||
|
> The [.tool-versions file](https://asdf-vm.com/manage/configuration.html#tool-versions) supports version specifications in accordance with asdf standards, adhering to Semantic Versioning ([semver](https://semver.org)).
|
||||||
|
|
||||||
## Matrix testing
|
## Matrix testing
|
||||||
|
|
||||||
|
|
@ -240,7 +249,7 @@ When dynamically downloading Go distributions, `setup-go` downloads distribution
|
||||||
|
|
||||||
These calls to `actions/go-versions` are made via unauthenticated requests, which are limited to [60 requests per hour per IP](https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting).
|
These calls to `actions/go-versions` are made via unauthenticated requests, which are limited to [60 requests per hour per IP](https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting).
|
||||||
If more requests are made within the time frame, then the action leverages the `raw API` to retrieve the version-manifest. This approach does not impose a rate limit and hence facilitates unrestricted consumption. This is particularly beneficial for GHES runners, which often share the same IP, to avoid the quick exhaustion of the unauthenticated rate limit.
|
If more requests are made within the time frame, then the action leverages the `raw API` to retrieve the version-manifest. This approach does not impose a rate limit and hence facilitates unrestricted consumption. This is particularly beneficial for GHES runners, which often share the same IP, to avoid the quick exhaustion of the unauthenticated rate limit.
|
||||||
If that fails as well the action will try to download versions directly from https://storage.googleapis.com/golang.
|
If that fails as well the action will try to download versions directly from https://go.dev/dl.
|
||||||
|
|
||||||
If that fails as well you can get a higher rate limit with [generating a personal access token on github.com](https://github.com/settings/tokens/new) and passing it as the `token` input to the action:
|
If that fails as well you can get a higher rate limit with [generating a personal access token on github.com](https://github.com/settings/tokens/new) and passing it as the `token` input to the action:
|
||||||
|
|
||||||
|
|
|
||||||
1
__tests__/data/.tool-versions
Normal file
1
__tests__/data/.tool-versions
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
golang 1.23.2
|
||||||
|
|
@ -8,6 +8,7 @@ import path from 'path';
|
||||||
import * as main from '../src/main';
|
import * as main from '../src/main';
|
||||||
import * as im from '../src/installer';
|
import * as im from '../src/installer';
|
||||||
import * as httpm from '@actions/http-client';
|
import * as httpm from '@actions/http-client';
|
||||||
|
import {getArch} from '../src/system';
|
||||||
|
|
||||||
import goJsonData from './data/golang-dl.json';
|
import goJsonData from './data/golang-dl.json';
|
||||||
import matchers from '../matchers.json';
|
import matchers from '../matchers.json';
|
||||||
|
|
@ -32,6 +33,7 @@ describe('setup-go', () => {
|
||||||
let getSpy: jest.SpyInstance;
|
let getSpy: jest.SpyInstance;
|
||||||
let platSpy: jest.SpyInstance;
|
let platSpy: jest.SpyInstance;
|
||||||
let archSpy: jest.SpyInstance;
|
let archSpy: jest.SpyInstance;
|
||||||
|
let endianSpy: jest.SpyInstance;
|
||||||
let joinSpy: jest.SpyInstance;
|
let joinSpy: jest.SpyInstance;
|
||||||
let dlSpy: jest.SpyInstance;
|
let dlSpy: jest.SpyInstance;
|
||||||
let extractTarSpy: jest.SpyInstance;
|
let extractTarSpy: jest.SpyInstance;
|
||||||
|
|
@ -71,6 +73,8 @@ describe('setup-go', () => {
|
||||||
archSpy = jest.spyOn(osm, 'arch');
|
archSpy = jest.spyOn(osm, 'arch');
|
||||||
archSpy.mockImplementation(() => os['arch']);
|
archSpy.mockImplementation(() => os['arch']);
|
||||||
execSpy = jest.spyOn(cp, 'execSync');
|
execSpy = jest.spyOn(cp, 'execSync');
|
||||||
|
endianSpy = jest.spyOn(osm, 'endianness');
|
||||||
|
endianSpy.mockImplementation(() => os['endianness']);
|
||||||
|
|
||||||
// switch path join behaviour based on set os.platform
|
// switch path join behaviour based on set os.platform
|
||||||
joinSpy = jest.spyOn(path, 'join');
|
joinSpy = jest.spyOn(path, 'join');
|
||||||
|
|
@ -389,7 +393,7 @@ describe('setup-go', () => {
|
||||||
|
|
||||||
const expPath = path.win32.join(toolPath, 'bin');
|
const expPath = path.win32.join(toolPath, 'bin');
|
||||||
expect(dlSpy).toHaveBeenCalledWith(
|
expect(dlSpy).toHaveBeenCalledWith(
|
||||||
'https://storage.googleapis.com/golang/go1.13.1.windows-amd64.zip',
|
'https://go.dev/dl/go1.13.1.windows-amd64.zip',
|
||||||
'C:\\temp\\go1.13.1.windows-amd64.zip',
|
'C:\\temp\\go1.13.1.windows-amd64.zip',
|
||||||
undefined
|
undefined
|
||||||
);
|
);
|
||||||
|
|
@ -866,6 +870,9 @@ exclude example.com/thismodule v1.3.0
|
||||||
|
|
||||||
use .
|
use .
|
||||||
|
|
||||||
|
`;
|
||||||
|
|
||||||
|
const toolVersionsContents = `golang 1.23
|
||||||
`;
|
`;
|
||||||
|
|
||||||
it('reads version from go.mod', async () => {
|
it('reads version from go.mod', async () => {
|
||||||
|
|
@ -892,6 +899,18 @@ use .
|
||||||
expect(logSpy).toHaveBeenCalledWith('matching 1.19...');
|
expect(logSpy).toHaveBeenCalledWith('matching 1.19...');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('reads version from .tool-versions', async () => {
|
||||||
|
inputs['go-version-file'] = '.tool-versions';
|
||||||
|
existsSpy.mockImplementation(() => true);
|
||||||
|
readFileSpy.mockImplementation(() => Buffer.from(toolVersionsContents));
|
||||||
|
|
||||||
|
await main.run();
|
||||||
|
|
||||||
|
expect(logSpy).toHaveBeenCalledWith('Setup go version spec 1.23');
|
||||||
|
expect(logSpy).toHaveBeenCalledWith('Attempting to download 1.23...');
|
||||||
|
expect(logSpy).toHaveBeenCalledWith('matching 1.23...');
|
||||||
|
});
|
||||||
|
|
||||||
it('reads version from .go-version', async () => {
|
it('reads version from .go-version', async () => {
|
||||||
inputs['go-version-file'] = '.go-version';
|
inputs['go-version-file'] = '.go-version';
|
||||||
existsSpy.mockImplementation(() => true);
|
existsSpy.mockImplementation(() => true);
|
||||||
|
|
@ -946,7 +965,7 @@ use .
|
||||||
const expectedUrl =
|
const expectedUrl =
|
||||||
platform === 'win32'
|
platform === 'win32'
|
||||||
? `https://github.com/actions/go-versions/releases/download/${version}/go-${version}-${platform}-${arch}.${fileExtension}`
|
? `https://github.com/actions/go-versions/releases/download/${version}/go-${version}-${platform}-${arch}.${fileExtension}`
|
||||||
: `https://storage.googleapis.com/golang/go${version}.${osSpec}-${arch}.${fileExtension}`;
|
: `https://go.dev/dl/go${version}.${osSpec}-${arch}.${fileExtension}`;
|
||||||
|
|
||||||
// ... but not in the local cache
|
// ... but not in the local cache
|
||||||
findSpy.mockImplementation(() => '');
|
findSpy.mockImplementation(() => '');
|
||||||
|
|
@ -989,6 +1008,18 @@ use .
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
it('should return ppc64 when architecture is ppc64 and system is Big Endian', () => {
|
||||||
|
endianSpy.mockReturnValue('BE');
|
||||||
|
const result = getArch('ppc64');
|
||||||
|
expect(result).toBe('ppc64');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return ppc64le when architecture is ppc64 and system is Little Endian', () => {
|
||||||
|
endianSpy.mockReturnValue('LE');
|
||||||
|
const result = getArch('ppc64');
|
||||||
|
expect(result).toBe('ppc64le');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('go-version-file-toolchain', () => {
|
describe('go-version-file-toolchain', () => {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ inputs:
|
||||||
go-version:
|
go-version:
|
||||||
description: 'The Go version to download (if necessary) and use. Supports semver spec and ranges. Be sure to enclose this option in single quotation marks.'
|
description: 'The Go version to download (if necessary) and use. Supports semver spec and ranges. Be sure to enclose this option in single quotation marks.'
|
||||||
go-version-file:
|
go-version-file:
|
||||||
description: 'Path to the go.mod or go.work file.'
|
description: 'Path to the go.mod, .tool-versions, or go.work file.'
|
||||||
check-latest:
|
check-latest:
|
||||||
description: 'Set this option to true if you want the action to always check for the latest available version that satisfies the version spec'
|
description: 'Set this option to true if you want the action to always check for the latest available version that satisfies the version spec'
|
||||||
default: false
|
default: false
|
||||||
|
|
|
||||||
22
dist/setup/index.js
vendored
22
dist/setup/index.js
vendored
|
|
@ -94583,7 +94583,7 @@ function getInfoFromDist(versionSpec, arch) {
|
||||||
if (!version) {
|
if (!version) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const downloadUrl = `https://storage.googleapis.com/golang/${version.files[0].filename}`;
|
const downloadUrl = `https://go.dev/dl/${version.files[0].filename}`;
|
||||||
return {
|
return {
|
||||||
type: 'dist',
|
type: 'dist',
|
||||||
downloadUrl: downloadUrl,
|
downloadUrl: downloadUrl,
|
||||||
|
|
@ -94679,6 +94679,10 @@ function parseGoVersionFile(versionFilePath) {
|
||||||
const matchGo = contents.match(/^go (\d+(\.\d+)*)/m);
|
const matchGo = contents.match(/^go (\d+(\.\d+)*)/m);
|
||||||
return matchGo ? matchGo[1] : '';
|
return matchGo ? matchGo[1] : '';
|
||||||
}
|
}
|
||||||
|
else if (path.basename(versionFilePath) === '.tool-versions') {
|
||||||
|
const match = contents.match(/^golang\s+([^\n#]+)/m);
|
||||||
|
return match ? match[1].trim() : '';
|
||||||
|
}
|
||||||
return contents.trim();
|
return contents.trim();
|
||||||
}
|
}
|
||||||
function resolveStableVersionDist(versionSpec, arch) {
|
function resolveStableVersionDist(versionSpec, arch) {
|
||||||
|
|
@ -94963,15 +94967,23 @@ function getPlatform() {
|
||||||
}
|
}
|
||||||
function getArch(arch) {
|
function getArch(arch) {
|
||||||
// 'arm', 'arm64', 'ia32', 'mips', 'mipsel', 'ppc', 'ppc64', 's390', 's390x', 'x32', and 'x64'.
|
// 'arm', 'arm64', 'ia32', 'mips', 'mipsel', 'ppc', 'ppc64', 's390', 's390x', 'x32', and 'x64'.
|
||||||
// wants amd64, 386, arm64, armv61, ppc641e, s390x
|
// wants amd64, 386, arm64, armv6l, ppc64le, s390x
|
||||||
// currently not supported by runner but future proofed mapping
|
// currently not supported by runner but future proofed mapping
|
||||||
switch (arch) {
|
switch (arch) {
|
||||||
case 'x64':
|
case 'x64':
|
||||||
arch = 'amd64';
|
arch = 'amd64';
|
||||||
break;
|
break;
|
||||||
// case 'ppc':
|
// In case of ppc64, further distinction is needed to determine the endianness
|
||||||
// arch = 'ppc64';
|
// of the host as it can either be ppc64(Big Endian) or ppc64le (Little Endian) to download
|
||||||
// break;
|
// the correct bundle.
|
||||||
|
case 'ppc64':
|
||||||
|
if (os_1.default.endianness() === 'LE') {
|
||||||
|
arch = 'ppc64le';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
arch = 'ppc64';
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'x32':
|
case 'x32':
|
||||||
arch = '386';
|
arch = '386';
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ process.on('uncaughtException', e => {
|
||||||
// Added early exit to resolve issue with slow post action step:
|
// Added early exit to resolve issue with slow post action step:
|
||||||
// - https://github.com/actions/setup-node/issues/878
|
// - https://github.com/actions/setup-node/issues/878
|
||||||
// https://github.com/actions/cache/pull/1217
|
// https://github.com/actions/cache/pull/1217
|
||||||
|
|
||||||
export async function run(earlyExit?: boolean) {
|
export async function run(earlyExit?: boolean) {
|
||||||
try {
|
try {
|
||||||
const cacheInput = core.getBooleanInput('cache');
|
const cacheInput = core.getBooleanInput('cache');
|
||||||
|
|
|
||||||
|
|
@ -389,7 +389,7 @@ async function getInfoFromDist(
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const downloadUrl = `https://storage.googleapis.com/golang/${version.files[0].filename}`;
|
const downloadUrl = `https://go.dev/dl/${version.files[0].filename}`;
|
||||||
|
|
||||||
return <IGoVersionInfo>{
|
return <IGoVersionInfo>{
|
||||||
type: 'dist',
|
type: 'dist',
|
||||||
|
|
@ -513,6 +513,9 @@ export function parseGoVersionFile(versionFilePath: string): string {
|
||||||
// go directive: https://go.dev/ref/mod#go-mod-file-go
|
// go directive: https://go.dev/ref/mod#go-mod-file-go
|
||||||
const matchGo = contents.match(/^go (\d+(\.\d+)*)/m);
|
const matchGo = contents.match(/^go (\d+(\.\d+)*)/m);
|
||||||
return matchGo ? matchGo[1] : '';
|
return matchGo ? matchGo[1] : '';
|
||||||
|
} else if (path.basename(versionFilePath) === '.tool-versions') {
|
||||||
|
const match = contents.match(/^golang\s+([^\n#]+)/m);
|
||||||
|
return match ? match[1].trim() : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return contents.trim();
|
return contents.trim();
|
||||||
|
|
|
||||||
|
|
@ -19,15 +19,22 @@ export function getPlatform(): string {
|
||||||
export function getArch(arch: Architecture): string {
|
export function getArch(arch: Architecture): string {
|
||||||
// 'arm', 'arm64', 'ia32', 'mips', 'mipsel', 'ppc', 'ppc64', 's390', 's390x', 'x32', and 'x64'.
|
// 'arm', 'arm64', 'ia32', 'mips', 'mipsel', 'ppc', 'ppc64', 's390', 's390x', 'x32', and 'x64'.
|
||||||
|
|
||||||
// wants amd64, 386, arm64, armv61, ppc641e, s390x
|
// wants amd64, 386, arm64, armv6l, ppc64le, s390x
|
||||||
// currently not supported by runner but future proofed mapping
|
// currently not supported by runner but future proofed mapping
|
||||||
switch (arch) {
|
switch (arch) {
|
||||||
case 'x64':
|
case 'x64':
|
||||||
arch = 'amd64';
|
arch = 'amd64';
|
||||||
break;
|
break;
|
||||||
// case 'ppc':
|
// In case of ppc64, further distinction is needed to determine the endianness
|
||||||
// arch = 'ppc64';
|
// of the host as it can either be ppc64(Big Endian) or ppc64le (Little Endian) to download
|
||||||
// break;
|
// the correct bundle.
|
||||||
|
case 'ppc64':
|
||||||
|
if (os.endianness() === 'LE') {
|
||||||
|
arch = 'ppc64le';
|
||||||
|
} else {
|
||||||
|
arch = 'ppc64';
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'x32':
|
case 'x32':
|
||||||
arch = '386';
|
arch = '386';
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue