From de2d1f407f65794900c074814effe336c85615dc Mon Sep 17 00:00:00 2001 From: Nicholas Ngai Date: Fri, 17 Oct 2025 12:11:05 -0700 Subject: [PATCH] Fall back to downloading from go.dev/dl instead of storage.googleapis.com/golang --- README.md | 4 ++-- __tests__/setup-go.test.ts | 4 ++-- dist/setup/index.js | 2 +- src/installer.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ee24eca..a4f3fd5 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ The V3 edition of the action offers: - stable and oldstable aliases - Bug Fixes (including issues around version matching and semver) -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 the [check-latest input](#check-latest-version). +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://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 golang from source code. @@ -199,7 +199,7 @@ For more information about semantic versioning, please refer to [semver](https:/ ## Using `setup-go` on GHES -`setup-go` comes pre-installed on the appliance with GHES if Actions is enabled. When dynamically downloading Go distributions, `setup-go` downloads distributions from [`actions/go-versions`](https://github.com/actions/go-versions) on github.com (outside of the appliance). 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 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. +`setup-go` comes pre-installed on the appliance with GHES if Actions is enabled. When dynamically downloading Go distributions, `setup-go` downloads distributions from [`actions/go-versions`](https://github.com/actions/go-versions) on github.com (outside of the appliance). 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 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://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` input for the action: diff --git a/__tests__/setup-go.test.ts b/__tests__/setup-go.test.ts index 2188fc9..b7f87ec 100644 --- a/__tests__/setup-go.test.ts +++ b/__tests__/setup-go.test.ts @@ -359,7 +359,7 @@ describe('setup-go', () => { let 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 ); @@ -913,7 +913,7 @@ use . let 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(() => ''); diff --git a/dist/setup/index.js b/dist/setup/index.js index 0abba3d..e657ebf 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -70997,7 +70997,7 @@ function getInfoFromDist(versionSpec, arch) { if (!version) { return null; } - let downloadUrl = `https://storage.googleapis.com/golang/${version.files[0].filename}`; + let downloadUrl = `https://go.dev/dl/${version.files[0].filename}`; return { type: 'dist', downloadUrl: downloadUrl, diff --git a/src/installer.ts b/src/installer.ts index 7074f5e..de5175b 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -252,7 +252,7 @@ async function getInfoFromDist( return null; } - let downloadUrl: string = `https://storage.googleapis.com/golang/${version.files[0].filename}`; + let downloadUrl: string = `https://go.dev/dl/${version.files[0].filename}`; return { type: 'dist',