Fall back to downloading from go.dev/dl instead of storage.googleapis.com/golang

This commit is contained in:
Nicholas Ngai 2025-10-17 12:11:23 -07:00
parent 19bb51245e
commit bedd28fa8f
No known key found for this signature in database
GPG Key ID: 65358B5A905963F4
4 changed files with 6 additions and 6 deletions

View File

@ -32,7 +32,7 @@ The V3 edition of the action offers:
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)
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).
**Note:** The `setup-go` action uses executable binaries which are built by Golang side. The action does not build
@ -234,7 +234,7 @@ 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 you will start to see rate-limit errors during downloading that looks
like: `##[error]API rate limit exceeded for...`. After that error the action will try to download versions directly
from https://storage.googleapis.com/golang, but it also can have rate limit so it's better to put token.
from https://go.dev/dl, but it also can have rate limit so it's better to put token.
To get a higher rate limit, you
can [generate a personal access token on github.com](https://github.com/settings/tokens/new) and pass it as the `token`

View File

@ -368,7 +368,7 @@ describe('setup-go', () => {
const expPath = path.win32.join(toolPath, 'bin');
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',
undefined
);
@ -922,7 +922,7 @@ use .
const expectedUrl =
platform === 'win32'
? `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
findSpy.mockImplementation(() => '');

2
dist/setup/index.js vendored
View File

@ -89676,7 +89676,7 @@ function getInfoFromDist(versionSpec, arch) {
if (!version) {
return null;
}
const downloadUrl = `https://storage.googleapis.com/golang/${version.files[0].filename}`;
const downloadUrl = `https://go.dev/dl/${version.files[0].filename}`;
return {
type: 'dist',
downloadUrl: downloadUrl,

View File

@ -304,7 +304,7 @@ async function getInfoFromDist(
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>{
type: 'dist',