Skip to content

Commit 7bc60db

Browse files
authored
Fall back to downloading from go.dev/dl instead of storage.googleapis.com/golang (#665)
* Fall back to downloading from dl.google.com/go instead of storage.googleapis.com/golang * Use go.dev/dl instead
1 parent c0137ca commit 7bc60db

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ See full release notes on the [releases page](https://github.com/actions/setup-g
2727
The action will first check the local cache for a version match. If a version is not found locally, it will pull it from
2828
the `main` branch of the [go-versions](https://github.com/actions/go-versions/blob/main/versions-manifest.json)
2929
repository. On miss or failure, it will fall back to downloading directly
30-
from [go dist](https://storage.googleapis.com/golang). To change the default behavior, please use
30+
from [go dist](https://go.dev/dl). To change the default behavior, please use
3131
the [check-latest input](#check-latest-version).
3232

3333
**Note:** The `setup-go` action uses executable binaries which are built by Golang side. The action does not build
@@ -240,7 +240,7 @@ When dynamically downloading Go distributions, `setup-go` downloads distribution
240240

241241
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).
242242
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.
243-
If that fails as well the action will try to download versions directly from https://storage.googleapis.com/golang.
243+
If that fails as well the action will try to download versions directly from https://go.dev/dl.
244244

245245
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:
246246

__tests__/setup-go.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ describe('setup-go', () => {
389389

390390
const expPath = path.win32.join(toolPath, 'bin');
391391
expect(dlSpy).toHaveBeenCalledWith(
392-
'https://storage.googleapis.com/golang/go1.13.1.windows-amd64.zip',
392+
'https://go.dev/dl/go1.13.1.windows-amd64.zip',
393393
'C:\\temp\\go1.13.1.windows-amd64.zip',
394394
undefined
395395
);
@@ -946,7 +946,7 @@ use .
946946
const expectedUrl =
947947
platform === 'win32'
948948
? `https://github.com/actions/go-versions/releases/download/${version}/go-${version}-${platform}-${arch}.${fileExtension}`
949-
: `https://storage.googleapis.com/golang/go${version}.${osSpec}-${arch}.${fileExtension}`;
949+
: `https://go.dev/dl/go${version}.${osSpec}-${arch}.${fileExtension}`;
950950

951951
// ... but not in the local cache
952952
findSpy.mockImplementation(() => '');

dist/setup/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94583,7 +94583,7 @@ function getInfoFromDist(versionSpec, arch) {
9458394583
if (!version) {
9458494584
return null;
9458594585
}
94586-
const downloadUrl = `https://storage.googleapis.com/golang/${version.files[0].filename}`;
94586+
const downloadUrl = `https://go.dev/dl/${version.files[0].filename}`;
9458794587
return {
9458894588
type: 'dist',
9458994589
downloadUrl: downloadUrl,

src/installer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ async function getInfoFromDist(
389389
return null;
390390
}
391391

392-
const downloadUrl = `https://storage.googleapis.com/golang/${version.files[0].filename}`;
392+
const downloadUrl = `https://go.dev/dl/${version.files[0].filename}`;
393393

394394
return <IGoVersionInfo>{
395395
type: 'dist',

0 commit comments

Comments
 (0)