mirror of https://github.com/actions/setup-go.git
				
				
				
			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
This commit is contained in:
		
							parent
							
								
									c0137caad7
								
							
						
					
					
						commit
						7bc60db215
					
				|  | @ -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 | ||||||
|  | @ -240,7 +240,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: | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -389,7 +389,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 | ||||||
|     ); |     ); | ||||||
|  | @ -946,7 +946,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(() => ''); | ||||||
|  |  | ||||||
|  | @ -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, | ||||||
|  |  | ||||||
|  | @ -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', | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Nicholas Ngai
						Nicholas Ngai