mirror of
				https://github.com/actions/setup-go.git
				synced 2025-10-31 15:50:33 +00:00 
			
		
		
		
	Compare commits
	
		
			2 Commits
		
	
	
		
			v3.0.0
			...
			thboop/nod
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 4314d44d94 | ||
|   | 28c3d5cef9 | 
							
								
								
									
										2
									
								
								.github/workflows/check-dist.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/check-dist.yml
									
									
									
									
										vendored
									
									
								
							| @@ -24,7 +24,7 @@ jobs: | |||||||
|       - uses: actions/checkout@v2 |       - uses: actions/checkout@v2 | ||||||
|  |  | ||||||
|       - name: Set Node.js 16.x |       - name: Set Node.js 16.x | ||||||
|         uses: actions/setup-node@v2 |         uses: actions/setup-node@v1 | ||||||
|         with: |         with: | ||||||
|           node-version: 16.x |           node-version: 16.x | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										6
									
								
								.github/workflows/licensed.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								.github/workflows/licensed.yml
									
									
									
									
										vendored
									
									
								
							| @@ -14,15 +14,11 @@ jobs: | |||||||
|     name: Check licenses |     name: Check licenses | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v2 |       - uses: actions/checkout@v2 | ||||||
|       - name: Set Node.js 16.x |  | ||||||
|         uses: actions/setup-node@v2 |  | ||||||
|         with: |  | ||||||
|           node-version: 16.x |  | ||||||
|       - run: npm ci |       - run: npm ci | ||||||
|       - name: Install licensed |       - name: Install licensed | ||||||
|         run: | |         run: | | ||||||
|           cd $RUNNER_TEMP |           cd $RUNNER_TEMP | ||||||
|           curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.4.4/licensed-3.4.4-linux-x64.tar.gz |           curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/2.12.2/licensed-2.12.2-linux-x64.tar.gz | ||||||
|           sudo tar -xzf licensed.tar.gz |           sudo tar -xzf licensed.tar.gz | ||||||
|           sudo mv licensed /usr/local/bin/licensed |           sudo mv licensed /usr/local/bin/licensed | ||||||
|       - run: licensed status |       - run: licensed status | ||||||
|   | |||||||
							
								
								
									
										19
									
								
								.github/workflows/versions.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										19
									
								
								.github/workflows/versions.yml
									
									
									
									
										vendored
									
									
								
							| @@ -33,23 +33,6 @@ jobs: | |||||||
|         run: __tests__/verify-go.sh ${{ matrix.go }} |         run: __tests__/verify-go.sh ${{ matrix.go }} | ||||||
|         shell: bash |         shell: bash | ||||||
|  |  | ||||||
|   check-latest: |  | ||||||
|     runs-on: ${{ matrix.os }} |  | ||||||
|     strategy: |  | ||||||
|       fail-fast: false |  | ||||||
|       matrix: |  | ||||||
|         os: [ubuntu-latest, windows-latest, macos-latest] |  | ||||||
|         go-version: [1.16, 1.17] |  | ||||||
|     steps: |  | ||||||
|       - uses: actions/checkout@v2 |  | ||||||
|       - name: Setup Go and check latest |  | ||||||
|         uses: ./ |  | ||||||
|         with: |  | ||||||
|           go-version: ${{ matrix.go-version }} |  | ||||||
|           check-latest: true |  | ||||||
|       - name: Verify Go |  | ||||||
|         run: go version |  | ||||||
|  |  | ||||||
|   setup-versions-from-manifest: |   setup-versions-from-manifest: | ||||||
|     name: Setup ${{ matrix.go }} ${{ matrix.os }} |     name: Setup ${{ matrix.go }} ${{ matrix.os }} | ||||||
|     runs-on: ${{ matrix.os }} |     runs-on: ${{ matrix.os }} | ||||||
| @@ -78,7 +61,7 @@ jobs: | |||||||
|       fail-fast: false |       fail-fast: false | ||||||
|       matrix: |       matrix: | ||||||
|         os: [macos-latest, windows-latest, ubuntu-latest] |         os: [macos-latest, windows-latest, ubuntu-latest] | ||||||
|         go: [1.9, 1.8.6] |         go: [1.7, 1.8.6] | ||||||
|     steps: |     steps: | ||||||
|       - name: Checkout |       - name: Checkout | ||||||
|         uses: actions/checkout@v2 |         uses: actions/checkout@v2 | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								.github/workflows/workflow.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.github/workflows/workflow.yml
									
									
									
									
										vendored
									
									
								
							| @@ -25,8 +25,8 @@ jobs: | |||||||
|           node-version: 16 |           node-version: 16 | ||||||
|           cache: npm |           cache: npm | ||||||
|  |  | ||||||
|       - name: npm ci |       - name: npm install | ||||||
|         run: npm ci |         run: npm install | ||||||
|  |  | ||||||
|       - name: Lint |       - name: Lint | ||||||
|         run: npm run format-check |         run: npm run format-check | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								.licenses/npm/@actions/core.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								.licenses/npm/@actions/core.dep.yml
									
									
									
										generated
									
									
									
								
							| @@ -1,6 +1,6 @@ | |||||||
| --- | --- | ||||||
| name: "@actions/core" | name: "@actions/core" | ||||||
| version: 1.6.0 | version: 1.2.6 | ||||||
| type: npm | type: npm | ||||||
| summary: Actions core lib | summary: Actions core lib | ||||||
| homepage: https://github.com/actions/toolkit/tree/main/packages/core | homepage: https://github.com/actions/toolkit/tree/main/packages/core | ||||||
|   | |||||||
							
								
								
									
										32
									
								
								.licenses/npm/@actions/http-client-1.0.11.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										32
									
								
								.licenses/npm/@actions/http-client-1.0.11.dep.yml
									
									
									
										generated
									
									
									
								
							| @@ -1,32 +0,0 @@ | |||||||
| --- |  | ||||||
| name: "@actions/http-client" |  | ||||||
| version: 1.0.11 |  | ||||||
| type: npm |  | ||||||
| summary: Actions Http Client |  | ||||||
| homepage: https://github.com/actions/http-client#readme |  | ||||||
| license: mit |  | ||||||
| licenses: |  | ||||||
| - sources: LICENSE |  | ||||||
|   text: | |  | ||||||
|     Actions Http Client for Node.js |  | ||||||
| 
 |  | ||||||
|     Copyright (c) GitHub, Inc. |  | ||||||
| 
 |  | ||||||
|     All rights reserved. |  | ||||||
| 
 |  | ||||||
|     MIT License |  | ||||||
| 
 |  | ||||||
|     Permission is hereby granted, free of charge, to any person obtaining a copy of this software and |  | ||||||
|     associated documentation files (the "Software"), to deal in the Software without restriction, |  | ||||||
|     including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, |  | ||||||
|     and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, |  | ||||||
|     subject to the following conditions: |  | ||||||
| 
 |  | ||||||
|     The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. |  | ||||||
| 
 |  | ||||||
|     THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT |  | ||||||
|     LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN |  | ||||||
|     NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |  | ||||||
|     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |  | ||||||
|     SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |  | ||||||
| notices: [] |  | ||||||
							
								
								
									
										32
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								README.md
									
									
									
									
									
								
							| @@ -16,11 +16,10 @@ This action sets up a go environment for use in actions by: | |||||||
| The V2 offers: | The V2 offers: | ||||||
| - Adds GOBIN to the PATH | - Adds GOBIN to the PATH | ||||||
| - Proxy Support | - Proxy Support | ||||||
| - `stable` input  | - stable input  | ||||||
| - Check latest version |  | ||||||
| - Bug Fixes (including issues around version matching and semver) | - 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). | It will first check the local cache for a version match. If version is not found locally, It will pull it from `main` branch of [go-versions](https://github.com/actions/go-versions/blob/main/versions-manifest.json) repository and on miss or failure, it will fall back to the previous behavior of download directly from [go dist](https://storage.googleapis.com/golang). | ||||||
|  |  | ||||||
| Matching by [semver spec](https://github.com/npm/node-semver): | Matching by [semver spec](https://github.com/npm/node-semver): | ||||||
| ```yaml | ```yaml | ||||||
| @@ -47,36 +46,17 @@ steps: | |||||||
|  |  | ||||||
| See [action.yml](action.yml) | See [action.yml](action.yml) | ||||||
|  |  | ||||||
| ## Basic: | Basic: | ||||||
| ```yaml | ```yaml | ||||||
| steps: | steps: | ||||||
|   - uses: actions/checkout@v2 |   - uses: actions/checkout@master | ||||||
|   - uses: actions/setup-go@v2 |   - uses: actions/setup-go@v2 | ||||||
|     with: |     with: | ||||||
|       go-version: '1.16.1' # The Go version to download (if necessary) and use. |       go-version: '1.9.3' # The Go version to download (if necessary) and use. | ||||||
|   - run: go run hello.go |   - run: go run hello.go | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
|  | Matrix Testing: | ||||||
| ## Check latest version:   |  | ||||||
|  |  | ||||||
| The `check-latest` flag defaults to `false`. Use the default or set `check-latest` to `false` if you prefer stability and if you want to ensure a specific Go version is always used. |  | ||||||
|  |  | ||||||
| If `check-latest` is set to `true`, the action first checks if the cached version is the latest one. If the locally cached version is not the most up-to-date, a Go version will then be downloaded. Set `check-latest` to `true` if you want the most up-to-date Go version to always be used. |  | ||||||
|  |  | ||||||
| > Setting `check-latest` to `true` has performance implications as downloading Go versions is slower than using cached versions. |  | ||||||
|  |  | ||||||
| ```yaml |  | ||||||
| steps: |  | ||||||
|   - uses: actions/checkout@v2 |  | ||||||
|   - uses: actions/setup-go@v2 |  | ||||||
|     with: |  | ||||||
|       go-version: '1.14' |  | ||||||
|       check-latest: true |  | ||||||
|   - run: go run hello.go |  | ||||||
| ``` |  | ||||||
|  |  | ||||||
| ## Matrix Testing: |  | ||||||
| ```yaml | ```yaml | ||||||
| jobs: | jobs: | ||||||
|   build: |   build: | ||||||
|   | |||||||
| @@ -1,29 +1,4 @@ | |||||||
| [ | [ | ||||||
|     { |  | ||||||
|       "version": "1.17.6", |  | ||||||
|       "stable": true, |  | ||||||
|       "release_url": "https://github.com/actions/go-versions/releases/tag/1.17.6-1668090892", |  | ||||||
|       "files": [ |  | ||||||
|         { |  | ||||||
|           "filename": "go-1.17.6-darwin-x64.tar.gz", |  | ||||||
|           "arch": "x64", |  | ||||||
|           "platform": "darwin", |  | ||||||
|           "download_url": "https://github.com/actions/go-versions/releases/download/1.17.6-1668090892/go-1.17.6-darwin-x64.tar.gz" |  | ||||||
|         }, |  | ||||||
|         { |  | ||||||
|           "filename": "go-1.17.6-linux-x64.tar.gz", |  | ||||||
|           "arch": "x64", |  | ||||||
|           "platform": "linux", |  | ||||||
|           "download_url": "https://github.com/actions/go-versions/releases/download/1.17.6-1668090892/go-1.17.6-linux-x64.tar.gz" |  | ||||||
|         }, |  | ||||||
|         { |  | ||||||
|           "filename": "go-1.17.6-win32-x64.zip", |  | ||||||
|           "arch": "x64", |  | ||||||
|           "platform": "win32", |  | ||||||
|           "download_url": "https://github.com/actions/go-versions/releases/download/1.17.6-1668090892/go-1.17.6-win32-x64.zip" |  | ||||||
|         } |  | ||||||
|       ] |  | ||||||
|     }, |  | ||||||
|     { |     { | ||||||
|       "version": "1.12.17", |       "version": "1.12.17", | ||||||
|       "stable": true, |       "stable": true, | ||||||
|   | |||||||
| @@ -19,7 +19,6 @@ describe('setup-go', () => { | |||||||
|   let os = {} as any; |   let os = {} as any; | ||||||
|  |  | ||||||
|   let inSpy: jest.SpyInstance; |   let inSpy: jest.SpyInstance; | ||||||
|   let getBooleanInputSpy: jest.SpyInstance; |  | ||||||
|   let findSpy: jest.SpyInstance; |   let findSpy: jest.SpyInstance; | ||||||
|   let cnSpy: jest.SpyInstance; |   let cnSpy: jest.SpyInstance; | ||||||
|   let logSpy: jest.SpyInstance; |   let logSpy: jest.SpyInstance; | ||||||
| @@ -36,19 +35,16 @@ describe('setup-go', () => { | |||||||
|   let execSpy: jest.SpyInstance; |   let execSpy: jest.SpyInstance; | ||||||
|   let getManifestSpy: jest.SpyInstance; |   let getManifestSpy: jest.SpyInstance; | ||||||
|  |  | ||||||
|   beforeAll(async () => { |   beforeAll(() => { | ||||||
|     process.env['GITHUB_ENV'] = ''; // Stub out Environment file functionality so we can verify it writes to standard out (toolkit is backwards compatible) |     process.env['GITHUB_PATH'] = ''; // Stub out ENV file functionality so we can verify it writes to standard out | ||||||
|   }, 100000); |     console.log('::stop-commands::stoptoken'); // Disable executing of runner commands when running tests in actions | ||||||
|  |   }); | ||||||
|  |  | ||||||
|   beforeEach(() => { |   beforeEach(() => { | ||||||
|     process.env['GITHUB_PATH'] = ''; // Stub out ENV file functionality so we can verify it writes to standard out |  | ||||||
|  |  | ||||||
|     // @actions/core |     // @actions/core | ||||||
|     inputs = {}; |     inputs = {}; | ||||||
|     inSpy = jest.spyOn(core, 'getInput'); |     inSpy = jest.spyOn(core, 'getInput'); | ||||||
|     inSpy.mockImplementation(name => inputs[name]); |     inSpy.mockImplementation(name => inputs[name]); | ||||||
|     getBooleanInputSpy = jest.spyOn(core, 'getBooleanInput'); |  | ||||||
|     getBooleanInputSpy.mockImplementation(name => inputs[name]); |  | ||||||
|  |  | ||||||
|     // node |     // node | ||||||
|     os = {}; |     os = {}; | ||||||
| @@ -85,7 +81,7 @@ describe('setup-go', () => { | |||||||
|     }); |     }); | ||||||
|     logSpy.mockImplementation(line => { |     logSpy.mockImplementation(line => { | ||||||
|       // uncomment to debug |       // uncomment to debug | ||||||
|       process.stderr.write('log:' + line + '\n'); |       // process.stderr.write('log:' + line + '\n'); | ||||||
|     }); |     }); | ||||||
|     dbgSpy.mockImplementation(msg => { |     dbgSpy.mockImplementation(msg => { | ||||||
|       // uncomment to see debug output |       // uncomment to see debug output | ||||||
| @@ -100,7 +96,7 @@ describe('setup-go', () => { | |||||||
|   }); |   }); | ||||||
|  |  | ||||||
|   afterAll(async () => { |   afterAll(async () => { | ||||||
|     jest.restoreAllMocks(); |     console.log('::stoptoken::'); // Re-enable executing of runner commands when running tests in actions | ||||||
|   }, 100000); |   }, 100000); | ||||||
|  |  | ||||||
|   it('can find 1.9.7 from manifest on osx', async () => { |   it('can find 1.9.7 from manifest on osx', async () => { | ||||||
| @@ -147,7 +143,7 @@ describe('setup-go', () => { | |||||||
|     os.arch = 'x64'; |     os.arch = 'x64'; | ||||||
|  |  | ||||||
|     // spec: 1.13.0 => 1.13 |     // spec: 1.13.0 => 1.13 | ||||||
|     let match: im.IGoVersion | undefined = await im.findMatch('1.13.0'); |     let match: im.IGoVersion | undefined = await im.findMatch('1.13.0', true); | ||||||
|     expect(match).toBeDefined(); |     expect(match).toBeDefined(); | ||||||
|     let version: string = match ? match.version : ''; |     let version: string = match ? match.version : ''; | ||||||
|     expect(version).toBe('go1.13'); |     expect(version).toBe('go1.13'); | ||||||
| @@ -160,7 +156,7 @@ describe('setup-go', () => { | |||||||
|     os.arch = 'x64'; |     os.arch = 'x64'; | ||||||
|  |  | ||||||
|     // spec: 1.13 => 1.13.7 (latest) |     // spec: 1.13 => 1.13.7 (latest) | ||||||
|     let match: im.IGoVersion | undefined = await im.findMatch('1.13'); |     let match: im.IGoVersion | undefined = await im.findMatch('1.13', true); | ||||||
|     expect(match).toBeDefined(); |     expect(match).toBeDefined(); | ||||||
|     let version: string = match ? match.version : ''; |     let version: string = match ? match.version : ''; | ||||||
|     expect(version).toBe('go1.13.7'); |     expect(version).toBe('go1.13.7'); | ||||||
| @@ -173,7 +169,7 @@ describe('setup-go', () => { | |||||||
|     os.arch = 'x64'; |     os.arch = 'x64'; | ||||||
|  |  | ||||||
|     // spec: ^1.13.6 => 1.13.7 |     // spec: ^1.13.6 => 1.13.7 | ||||||
|     let match: im.IGoVersion | undefined = await im.findMatch('^1.13.6'); |     let match: im.IGoVersion | undefined = await im.findMatch('^1.13.6', true); | ||||||
|     expect(match).toBeDefined(); |     expect(match).toBeDefined(); | ||||||
|     let version: string = match ? match.version : ''; |     let version: string = match ? match.version : ''; | ||||||
|     expect(version).toBe('go1.13.7'); |     expect(version).toBe('go1.13.7'); | ||||||
| @@ -186,7 +182,7 @@ describe('setup-go', () => { | |||||||
|     os.arch = 'x32'; |     os.arch = 'x32'; | ||||||
|  |  | ||||||
|     // spec: 1 => 1.13.7 (latest) |     // spec: 1 => 1.13.7 (latest) | ||||||
|     let match: im.IGoVersion | undefined = await im.findMatch('1'); |     let match: im.IGoVersion | undefined = await im.findMatch('1', true); | ||||||
|     expect(match).toBeDefined(); |     expect(match).toBeDefined(); | ||||||
|     let version: string = match ? match.version : ''; |     let version: string = match ? match.version : ''; | ||||||
|     expect(version).toBe('go1.13.7'); |     expect(version).toBe('go1.13.7'); | ||||||
| @@ -199,7 +195,10 @@ describe('setup-go', () => { | |||||||
|     os.arch = 'x64'; |     os.arch = 'x64'; | ||||||
|  |  | ||||||
|     // spec: 1.14, stable=false => go1.14rc1 |     // spec: 1.14, stable=false => go1.14rc1 | ||||||
|     let match: im.IGoVersion | undefined = await im.findMatch('1.14.0-rc.1'); |     let match: im.IGoVersion | undefined = await im.findMatch( | ||||||
|  |       '1.14.0-rc1', | ||||||
|  |       false | ||||||
|  |     ); | ||||||
|     expect(match).toBeDefined(); |     expect(match).toBeDefined(); | ||||||
|     let version: string = match ? match.version : ''; |     let version: string = match ? match.version : ''; | ||||||
|     expect(version).toBe('go1.14rc1'); |     expect(version).toBe('go1.14rc1'); | ||||||
| @@ -215,7 +214,7 @@ describe('setup-go', () => { | |||||||
|     findSpy.mockImplementation(() => toolPath); |     findSpy.mockImplementation(() => toolPath); | ||||||
|     await main.run(); |     await main.run(); | ||||||
|  |  | ||||||
|     expect(logSpy).toHaveBeenCalledWith(`Setup go version spec 1.13.0`); |     expect(logSpy).toHaveBeenCalledWith(`Setup go stable version spec 1.13.0`); | ||||||
|   }); |   }); | ||||||
|  |  | ||||||
|   it('evaluates to stable with no input', async () => { |   it('evaluates to stable with no input', async () => { | ||||||
| @@ -227,7 +226,7 @@ describe('setup-go', () => { | |||||||
|     findSpy.mockImplementation(() => toolPath); |     findSpy.mockImplementation(() => toolPath); | ||||||
|     await main.run(); |     await main.run(); | ||||||
|  |  | ||||||
|     expect(logSpy).toHaveBeenCalledWith(`Setup go version spec 1.13.0`); |     expect(logSpy).toHaveBeenCalledWith(`Setup go stable version spec 1.13.0`); | ||||||
|   }); |   }); | ||||||
|  |  | ||||||
|   it('finds a version of go already in the cache', async () => { |   it('finds a version of go already in the cache', async () => { | ||||||
| @@ -300,6 +299,7 @@ describe('setup-go', () => { | |||||||
|     os.platform = 'linux'; |     os.platform = 'linux'; | ||||||
|     os.arch = 'x64'; |     os.arch = 'x64'; | ||||||
|  |  | ||||||
|  |     // a version which is in the manifest | ||||||
|     let versionSpec = '1.12.16'; |     let versionSpec = '1.12.16'; | ||||||
|  |  | ||||||
|     inputs['go-version'] = versionSpec; |     inputs['go-version'] = versionSpec; | ||||||
| @@ -337,6 +337,7 @@ describe('setup-go', () => { | |||||||
|     os.platform = 'linux'; |     os.platform = 'linux'; | ||||||
|     os.arch = 'x64'; |     os.arch = 'x64'; | ||||||
|  |  | ||||||
|  |     // a version which is in the manifest | ||||||
|     let versionSpec = '1.12'; |     let versionSpec = '1.12'; | ||||||
|  |  | ||||||
|     inputs['go-version'] = versionSpec; |     inputs['go-version'] = versionSpec; | ||||||
| @@ -374,6 +375,7 @@ describe('setup-go', () => { | |||||||
|     os.platform = 'linux'; |     os.platform = 'linux'; | ||||||
|     os.arch = 'x64'; |     os.arch = 'x64'; | ||||||
|  |  | ||||||
|  |     // a version which is not in the manifest but is in node dist | ||||||
|     let versionSpec = '1.12.14'; |     let versionSpec = '1.12.14'; | ||||||
|  |  | ||||||
|     inputs['go-version'] = versionSpec; |     inputs['go-version'] = versionSpec; | ||||||
| @@ -393,7 +395,7 @@ describe('setup-go', () => { | |||||||
|     await main.run(); |     await main.run(); | ||||||
|  |  | ||||||
|     let expPath = path.join(toolPath, 'bin'); |     let expPath = path.join(toolPath, 'bin'); | ||||||
|     expect(logSpy).toHaveBeenCalledWith('Setup go version spec 1.12.14'); |     expect(logSpy).toHaveBeenCalledWith('Setup go stable version spec 1.12.14'); | ||||||
|     expect(findSpy).toHaveBeenCalled(); |     expect(findSpy).toHaveBeenCalled(); | ||||||
|     expect(logSpy).toHaveBeenCalledWith('Attempting to download 1.12.14...'); |     expect(logSpy).toHaveBeenCalledWith('Attempting to download 1.12.14...'); | ||||||
|     expect(dlSpy).toHaveBeenCalled(); |     expect(dlSpy).toHaveBeenCalled(); | ||||||
| @@ -557,11 +559,11 @@ describe('setup-go', () => { | |||||||
|  |  | ||||||
|   // 1.13.1 => 1.13.1 |   // 1.13.1 => 1.13.1 | ||||||
|   // 1.13 => 1.13.0 |   // 1.13 => 1.13.0 | ||||||
|   // 1.10beta1 => 1.10.0-beta.1, 1.10rc1 => 1.10.0-rc.1 |   // 1.10beta1 => 1.10.0-beta1, 1.10rc1 => 1.10.0-rc1 | ||||||
|   // 1.8.5beta1 => 1.8.5-beta.1, 1.8.5rc1 => 1.8.5-rc.1 |   // 1.8.5beta1 => 1.8.5-beta1, 1.8.5rc1 => 1.8.5-rc1 | ||||||
|   it('converts prerelease versions', async () => { |   it('converts prerelease versions', async () => { | ||||||
|     expect(im.makeSemver('1.10beta1')).toBe('1.10.0-beta.1'); |     expect(im.makeSemver('1.10beta1')).toBe('1.10.0-beta1'); | ||||||
|     expect(im.makeSemver('1.10rc1')).toBe('1.10.0-rc.1'); |     expect(im.makeSemver('1.10rc1')).toBe('1.10.0-rc1'); | ||||||
|   }); |   }); | ||||||
|  |  | ||||||
|   it('converts dot zero versions', async () => { |   it('converts dot zero versions', async () => { | ||||||
| @@ -571,166 +573,4 @@ describe('setup-go', () => { | |||||||
|   it('does not convert exact versions', async () => { |   it('does not convert exact versions', async () => { | ||||||
|     expect(im.makeSemver('1.13.1')).toBe('1.13.1'); |     expect(im.makeSemver('1.13.1')).toBe('1.13.1'); | ||||||
|   }); |   }); | ||||||
|  |  | ||||||
|   describe('check-latest flag', () => { |  | ||||||
|     it("use local version and don't check manifest if check-latest is not specified", async () => { |  | ||||||
|       os.platform = 'linux'; |  | ||||||
|       os.arch = 'x64'; |  | ||||||
|  |  | ||||||
|       inputs['go-version'] = '1.16'; |  | ||||||
|       inputs['check-latest'] = false; |  | ||||||
|  |  | ||||||
|       const toolPath = path.normalize('/cache/go/1.16.1/x64'); |  | ||||||
|       findSpy.mockReturnValue(toolPath); |  | ||||||
|       await main.run(); |  | ||||||
|  |  | ||||||
|       expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`); |  | ||||||
|       expect(logSpy).not.toHaveBeenCalledWith( |  | ||||||
|         'Attempting to resolve the latest version from the manifest...' |  | ||||||
|       ); |  | ||||||
|     }); |  | ||||||
|  |  | ||||||
|     it('check latest version and resolve it from local cache', async () => { |  | ||||||
|       os.platform = 'linux'; |  | ||||||
|       os.arch = 'x64'; |  | ||||||
|  |  | ||||||
|       inputs['go-version'] = '1.16'; |  | ||||||
|       inputs['check-latest'] = true; |  | ||||||
|  |  | ||||||
|       const toolPath = path.normalize('/cache/go/1.16.1/x64'); |  | ||||||
|       findSpy.mockReturnValue(toolPath); |  | ||||||
|       dlSpy.mockImplementation(async () => '/some/temp/path'); |  | ||||||
|       exSpy.mockImplementation(async () => '/some/other/temp/path'); |  | ||||||
|       cacheSpy.mockImplementation(async () => toolPath); |  | ||||||
|  |  | ||||||
|       await main.run(); |  | ||||||
|  |  | ||||||
|       expect(logSpy).toHaveBeenCalledWith('Setup go version spec 1.16'); |  | ||||||
|       expect(logSpy).toHaveBeenCalledWith(`Found in cache @ ${toolPath}`); |  | ||||||
|     }); |  | ||||||
|  |  | ||||||
|     it('check latest version and install it from manifest', async () => { |  | ||||||
|       os.platform = 'linux'; |  | ||||||
|       os.arch = 'x64'; |  | ||||||
|  |  | ||||||
|       const versionSpec = '1.17'; |  | ||||||
|       const patchVersion = '1.17.6'; |  | ||||||
|       inputs['go-version'] = versionSpec; |  | ||||||
|       inputs['stable'] = 'true'; |  | ||||||
|       inputs['check-latest'] = true; |  | ||||||
|  |  | ||||||
|       findSpy.mockImplementation(() => ''); |  | ||||||
|       dlSpy.mockImplementation(async () => '/some/temp/path'); |  | ||||||
|       const toolPath = path.normalize('/cache/go/1.17.5/x64'); |  | ||||||
|       exSpy.mockImplementation(async () => '/some/other/temp/path'); |  | ||||||
|       cacheSpy.mockImplementation(async () => toolPath); |  | ||||||
|       const expectedUrl = |  | ||||||
|         'https://github.com/actions/go-versions/releases/download/1.17.6-1668090892/go-1.17.6-darwin-x64.tar.gz'; |  | ||||||
|  |  | ||||||
|       await main.run(); |  | ||||||
|  |  | ||||||
|       expect(logSpy).toHaveBeenCalledWith( |  | ||||||
|         `Setup go version spec ${versionSpec}` |  | ||||||
|       ); |  | ||||||
|       expect(logSpy).toHaveBeenCalledWith( |  | ||||||
|         'Attempting to resolve the latest version from the manifest...' |  | ||||||
|       ); |  | ||||||
|       expect(logSpy).toHaveBeenCalledWith(`Resolved as '${patchVersion}'`); |  | ||||||
|       expect(logSpy).toHaveBeenCalledWith( |  | ||||||
|         `Attempting to download ${patchVersion}...` |  | ||||||
|       ); |  | ||||||
|       expect(logSpy).toHaveBeenCalledWith('Extracting Go...'); |  | ||||||
|       expect(logSpy).toHaveBeenCalledWith('Adding to the cache ...'); |  | ||||||
|       expect(logSpy).toHaveBeenCalledWith('Added go to the path'); |  | ||||||
|       expect(logSpy).toHaveBeenCalledWith( |  | ||||||
|         `Successfully setup go version ${versionSpec}` |  | ||||||
|       ); |  | ||||||
|     }); |  | ||||||
|  |  | ||||||
|     it('fallback to dist if version is not found in manifest', async () => { |  | ||||||
|       os.platform = 'linux'; |  | ||||||
|       os.arch = 'x64'; |  | ||||||
|  |  | ||||||
|       let versionSpec = '1.13'; |  | ||||||
|  |  | ||||||
|       inputs['go-version'] = versionSpec; |  | ||||||
|       inputs['check-latest'] = true; |  | ||||||
|       inputs['always-auth'] = false; |  | ||||||
|       inputs['token'] = 'faketoken'; |  | ||||||
|  |  | ||||||
|       // ... but not in the local cache |  | ||||||
|       findSpy.mockImplementation(() => ''); |  | ||||||
|  |  | ||||||
|       dlSpy.mockImplementation(async () => '/some/temp/path'); |  | ||||||
|       let toolPath = path.normalize('/cache/go/1.13.7/x64'); |  | ||||||
|       exSpy.mockImplementation(async () => '/some/other/temp/path'); |  | ||||||
|       cacheSpy.mockImplementation(async () => toolPath); |  | ||||||
|  |  | ||||||
|       await main.run(); |  | ||||||
|  |  | ||||||
|       let expPath = path.join(toolPath, 'bin'); |  | ||||||
|  |  | ||||||
|       expect(dlSpy).toHaveBeenCalled(); |  | ||||||
|       expect(exSpy).toHaveBeenCalled(); |  | ||||||
|       expect(logSpy).toHaveBeenCalledWith( |  | ||||||
|         'Attempting to resolve the latest version from the manifest...' |  | ||||||
|       ); |  | ||||||
|       expect(logSpy).toHaveBeenCalledWith( |  | ||||||
|         `Failed to resolve version ${versionSpec} from manifest` |  | ||||||
|       ); |  | ||||||
|       expect(logSpy).toHaveBeenCalledWith( |  | ||||||
|         `Attempting to download ${versionSpec}...` |  | ||||||
|       ); |  | ||||||
|       expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`); |  | ||||||
|     }); |  | ||||||
|  |  | ||||||
|     it('fallback to dist if manifest is not available', async () => { |  | ||||||
|       os.platform = 'linux'; |  | ||||||
|       os.arch = 'x64'; |  | ||||||
|  |  | ||||||
|       let versionSpec = '1.13'; |  | ||||||
|  |  | ||||||
|       process.env['GITHUB_PATH'] = ''; |  | ||||||
|  |  | ||||||
|       inputs['go-version'] = versionSpec; |  | ||||||
|       inputs['check-latest'] = true; |  | ||||||
|       inputs['always-auth'] = false; |  | ||||||
|       inputs['token'] = 'faketoken'; |  | ||||||
|  |  | ||||||
|       // ... but not in the local cache |  | ||||||
|       findSpy.mockImplementation(() => ''); |  | ||||||
|       getManifestSpy.mockImplementation(() => { |  | ||||||
|         throw new Error('Unable to download manifest'); |  | ||||||
|       }); |  | ||||||
|  |  | ||||||
|       dlSpy.mockImplementation(async () => '/some/temp/path'); |  | ||||||
|       let toolPath = path.normalize('/cache/go/1.13.7/x64'); |  | ||||||
|       exSpy.mockImplementation(async () => '/some/other/temp/path'); |  | ||||||
|       cacheSpy.mockImplementation(async () => toolPath); |  | ||||||
|  |  | ||||||
|       await main.run(); |  | ||||||
|  |  | ||||||
|       let expPath = path.join(toolPath, 'bin'); |  | ||||||
|  |  | ||||||
|       expect(logSpy).toHaveBeenCalledWith( |  | ||||||
|         `Failed to resolve version ${versionSpec} from manifest` |  | ||||||
|       ); |  | ||||||
|       expect(dlSpy).toHaveBeenCalled(); |  | ||||||
|       expect(exSpy).toHaveBeenCalled(); |  | ||||||
|       expect(logSpy).toHaveBeenCalledWith( |  | ||||||
|         'Attempting to resolve the latest version from the manifest...' |  | ||||||
|       ); |  | ||||||
|       expect(logSpy).toHaveBeenCalledWith( |  | ||||||
|         'Unable to resolve a version from the manifest...' |  | ||||||
|       ); |  | ||||||
|       expect(logSpy).toHaveBeenCalledWith( |  | ||||||
|         `Failed to resolve version ${versionSpec} from manifest` |  | ||||||
|       ); |  | ||||||
|       expect(logSpy).toHaveBeenCalledWith( |  | ||||||
|         `Attempting to download ${versionSpec}...` |  | ||||||
|       ); |  | ||||||
|  |  | ||||||
|       expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`); |  | ||||||
|     }); |  | ||||||
|   }); |  | ||||||
| }); | }); | ||||||
|   | |||||||
| @@ -4,9 +4,9 @@ author: 'GitHub' | |||||||
| inputs:  | inputs:  | ||||||
|   go-version: |   go-version: | ||||||
|     description: 'The Go version to download (if necessary) and use. Supports semver spec and ranges.' |     description: 'The Go version to download (if necessary) and use. Supports semver spec and ranges.' | ||||||
|   check-latest: |   stable: | ||||||
|     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: 'Whether to download only stable versions' | ||||||
|     default: false |     default: 'true' | ||||||
|   token: |   token: | ||||||
|     description: Used to pull node distributions from go-versions.  Since there's a default, this is typically not supplied by the user. |     description: Used to pull node distributions from go-versions.  Since there's a default, this is typically not supplied by the user. | ||||||
|     default: ${{ github.token }} |     default: ${{ github.token }} | ||||||
|   | |||||||
							
								
								
									
										997
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										997
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										4712
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										4712
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -23,7 +23,7 @@ | |||||||
|   "author": "GitHub", |   "author": "GitHub", | ||||||
|   "license": "MIT", |   "license": "MIT", | ||||||
|   "dependencies": { |   "dependencies": { | ||||||
|     "@actions/core": "^1.6.0", |     "@actions/core": "^1.2.6", | ||||||
|     "@actions/http-client": "^1.0.6", |     "@actions/http-client": "^1.0.6", | ||||||
|     "@actions/io": "^1.0.2", |     "@actions/io": "^1.0.2", | ||||||
|     "@actions/tool-cache": "^1.5.5", |     "@actions/tool-cache": "^1.5.5", | ||||||
| @@ -31,7 +31,7 @@ | |||||||
|   }, |   }, | ||||||
|   "devDependencies": { |   "devDependencies": { | ||||||
|     "@types/jest": "^27.0.2", |     "@types/jest": "^27.0.2", | ||||||
|     "@types/node": "^16.11.25", |     "@types/node": "^12.0.4", | ||||||
|     "@types/semver": "^6.0.0", |     "@types/semver": "^6.0.0", | ||||||
|     "@zeit/ncc": "^0.21.0", |     "@zeit/ncc": "^0.21.0", | ||||||
|     "jest": "^27.2.5", |     "jest": "^27.2.5", | ||||||
|   | |||||||
| @@ -30,27 +30,12 @@ export interface IGoVersionInfo { | |||||||
|  |  | ||||||
| export async function getGo( | export async function getGo( | ||||||
|   versionSpec: string, |   versionSpec: string, | ||||||
|   checkLatest: boolean, |   stable: boolean, | ||||||
|   auth: string | undefined |   auth: string | undefined | ||||||
| ) { | ) { | ||||||
|   let osPlat: string = os.platform(); |   let osPlat: string = os.platform(); | ||||||
|   let osArch: string = os.arch(); |   let osArch: string = os.arch(); | ||||||
|  |  | ||||||
|   if (checkLatest) { |  | ||||||
|     core.info('Attempting to resolve the latest version from the manifest...'); |  | ||||||
|     const resolvedVersion = await resolveVersionFromManifest( |  | ||||||
|       versionSpec, |  | ||||||
|       true, |  | ||||||
|       auth |  | ||||||
|     ); |  | ||||||
|     if (resolvedVersion) { |  | ||||||
|       versionSpec = resolvedVersion; |  | ||||||
|       core.info(`Resolved as '${versionSpec}'`); |  | ||||||
|     } else { |  | ||||||
|       core.info(`Failed to resolve version ${versionSpec} from manifest`); |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   // check cache |   // check cache | ||||||
|   let toolPath: string; |   let toolPath: string; | ||||||
|   toolPath = tc.find('go', versionSpec); |   toolPath = tc.find('go', versionSpec); | ||||||
| @@ -67,7 +52,7 @@ export async function getGo( | |||||||
|   // Try download from internal distribution (popular versions only) |   // Try download from internal distribution (popular versions only) | ||||||
|   // |   // | ||||||
|   try { |   try { | ||||||
|     info = await getInfoFromManifest(versionSpec, true, auth); |     info = await getInfoFromManifest(versionSpec, stable, auth); | ||||||
|     if (info) { |     if (info) { | ||||||
|       downloadPath = await installGoVersion(info, auth); |       downloadPath = await installGoVersion(info, auth); | ||||||
|     } else { |     } else { | ||||||
| @@ -94,7 +79,7 @@ export async function getGo( | |||||||
|   // Download from storage.googleapis.com |   // Download from storage.googleapis.com | ||||||
|   // |   // | ||||||
|   if (!downloadPath) { |   if (!downloadPath) { | ||||||
|     info = await getInfoFromDist(versionSpec); |     info = await getInfoFromDist(versionSpec, stable); | ||||||
|     if (!info) { |     if (!info) { | ||||||
|       throw new Error( |       throw new Error( | ||||||
|         `Unable to find Go version '${versionSpec}' for platform ${osPlat} and architecture ${osArch}.` |         `Unable to find Go version '${versionSpec}' for platform ${osPlat} and architecture ${osArch}.` | ||||||
| @@ -112,20 +97,6 @@ export async function getGo( | |||||||
|   return downloadPath; |   return downloadPath; | ||||||
| } | } | ||||||
|  |  | ||||||
| async function resolveVersionFromManifest( |  | ||||||
|   versionSpec: string, |  | ||||||
|   stable: boolean, |  | ||||||
|   auth: string | undefined |  | ||||||
| ): Promise<string | undefined> { |  | ||||||
|   try { |  | ||||||
|     const info = await getInfoFromManifest(versionSpec, stable, auth); |  | ||||||
|     return info?.resolvedVersion; |  | ||||||
|   } catch (err) { |  | ||||||
|     core.info('Unable to resolve a version from the manifest...'); |  | ||||||
|     core.debug(err.message); |  | ||||||
|   } |  | ||||||
| } |  | ||||||
|  |  | ||||||
| async function installGoVersion( | async function installGoVersion( | ||||||
|   info: IGoVersionInfo, |   info: IGoVersionInfo, | ||||||
|   auth: string | undefined |   auth: string | undefined | ||||||
| @@ -190,10 +161,11 @@ export async function getInfoFromManifest( | |||||||
| } | } | ||||||
|  |  | ||||||
| async function getInfoFromDist( | async function getInfoFromDist( | ||||||
|   versionSpec: string |   versionSpec: string, | ||||||
|  |   stable: boolean | ||||||
| ): Promise<IGoVersionInfo | null> { | ): Promise<IGoVersionInfo | null> { | ||||||
|   let version: IGoVersion | undefined; |   let version: IGoVersion | undefined; | ||||||
|   version = await findMatch(versionSpec); |   version = await findMatch(versionSpec, stable); | ||||||
|   if (!version) { |   if (!version) { | ||||||
|     return null; |     return null; | ||||||
|   } |   } | ||||||
| @@ -209,7 +181,8 @@ async function getInfoFromDist( | |||||||
| } | } | ||||||
|  |  | ||||||
| export async function findMatch( | export async function findMatch( | ||||||
|   versionSpec: string |   versionSpec: string, | ||||||
|  |   stable: boolean | ||||||
| ): Promise<IGoVersion | undefined> { | ): Promise<IGoVersion | undefined> { | ||||||
|   let archFilter = sys.getArch(); |   let archFilter = sys.getArch(); | ||||||
|   let platFilter = sys.getPlatform(); |   let platFilter = sys.getPlatform(); | ||||||
| @@ -230,8 +203,18 @@ export async function findMatch( | |||||||
|     let candidate: IGoVersion = candidates[i]; |     let candidate: IGoVersion = candidates[i]; | ||||||
|     let version = makeSemver(candidate.version); |     let version = makeSemver(candidate.version); | ||||||
|  |  | ||||||
|  |     // 1.13.0 is advertised as 1.13 preventing being able to match exactly 1.13.0 | ||||||
|  |     // since a semver of 1.13 would match latest 1.13 | ||||||
|  |     let parts: string[] = version.split('.'); | ||||||
|  |     if (parts.length == 2) { | ||||||
|  |       version = version + '.0'; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     core.debug(`check ${version} satisfies ${versionSpec}`); |     core.debug(`check ${version} satisfies ${versionSpec}`); | ||||||
|     if (semver.satisfies(version, versionSpec)) { |     if ( | ||||||
|  |       semver.satisfies(version, versionSpec) && | ||||||
|  |       (!stable || candidate.stable === stable) | ||||||
|  |     ) { | ||||||
|       goFile = candidate.files.find(file => { |       goFile = candidate.files.find(file => { | ||||||
|         core.debug( |         core.debug( | ||||||
|           `${file.arch}===${archFilter} && ${file.os}===${platFilter}` |           `${file.arch}===${archFilter} && ${file.os}===${platFilter}` | ||||||
| @@ -271,30 +254,20 @@ export async function getVersionsDist( | |||||||
| // Convert the go version syntax into semver for semver matching | // Convert the go version syntax into semver for semver matching | ||||||
| // 1.13.1 => 1.13.1 | // 1.13.1 => 1.13.1 | ||||||
| // 1.13 => 1.13.0 | // 1.13 => 1.13.0 | ||||||
| // 1.10beta1 => 1.10.0-beta.1, 1.10rc1 => 1.10.0-rc.1 | // 1.10beta1 => 1.10.0-beta1, 1.10rc1 => 1.10.0-rc1 | ||||||
| // 1.8.5beta1 => 1.8.5-beta.1, 1.8.5rc1 => 1.8.5-rc.1 | // 1.8.5beta1 => 1.8.5-beta1, 1.8.5rc1 => 1.8.5-rc1 | ||||||
| export function makeSemver(version: string): string { | export function makeSemver(version: string): string { | ||||||
|   version = version.replace('go', ''); |   version = version.replace('go', ''); | ||||||
|   version = version.replace('beta', '-beta.').replace('rc', '-rc.'); |   version = version.replace('beta', '-beta').replace('rc', '-rc'); | ||||||
|   let parts = version.split('-'); |   let parts = version.split('-'); | ||||||
|  |  | ||||||
|   let semVersion = semver.coerce(parts[0])?.version; |   let verPart: string = parts[0]; | ||||||
|   if (!semVersion) { |   let prereleasePart = parts.length > 1 ? `-${parts[1]}` : ''; | ||||||
|     throw new Error( |  | ||||||
|       `The version: ${version} can't be changed to SemVer notation` |   let verParts: string[] = verPart.split('.'); | ||||||
|     ); |   if (verParts.length == 2) { | ||||||
|  |     verPart += '.0'; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   if (!parts[1]) { |   return `${verPart}${prereleasePart}`; | ||||||
|     return semVersion; |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   const fullVersion = semver.valid(`${semVersion}-${parts[1]}`); |  | ||||||
|  |  | ||||||
|   if (!fullVersion) { |  | ||||||
|     throw new Error( |  | ||||||
|       `The version: ${version} can't be changed to SemVer notation` |  | ||||||
|     ); |  | ||||||
|   } |  | ||||||
|   return fullVersion; |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -14,14 +14,17 @@ export async function run() { | |||||||
|     // |     // | ||||||
|     let versionSpec = core.getInput('go-version'); |     let versionSpec = core.getInput('go-version'); | ||||||
|  |  | ||||||
|     core.info(`Setup go version spec ${versionSpec}`); |     // stable will be true unless false is the exact input | ||||||
|  |     // since getting unstable versions should be explicit | ||||||
|  |     let stable = (core.getInput('stable') || 'true').toUpperCase() === 'TRUE'; | ||||||
|  |  | ||||||
|  |     core.info(`Setup go ${stable ? 'stable' : ''} version spec ${versionSpec}`); | ||||||
|  |  | ||||||
|     if (versionSpec) { |     if (versionSpec) { | ||||||
|       let token = core.getInput('token'); |       let token = core.getInput('token'); | ||||||
|       let auth = !token || isGhes() ? undefined : `token ${token}`; |       let auth = !token || isGhes() ? undefined : `token ${token}`; | ||||||
|  |  | ||||||
|       const checkLatest = core.getBooleanInput('check-latest'); |       const installDir = await installer.getGo(versionSpec, stable, auth); | ||||||
|       const installDir = await installer.getGo(versionSpec, checkLatest, auth); |  | ||||||
|  |  | ||||||
|       core.exportVariable('GOROOT', installDir); |       core.exportVariable('GOROOT', installDir); | ||||||
|       core.addPath(path.join(installDir, 'bin')); |       core.addPath(path.join(installDir, 'bin')); | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| const os = require('os'); | let os = require('os'); | ||||||
|  |  | ||||||
| export function getPlatform(): string { | export function getPlatform(): string { | ||||||
|   // darwin and linux match already |   // darwin and linux match already | ||||||
|   | |||||||
| @@ -4,6 +4,9 @@ | |||||||
|     // "incremental": true,                   /* Enable incremental compilation */ |     // "incremental": true,                   /* Enable incremental compilation */ | ||||||
|     "target": "es6",                          /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ |     "target": "es6",                          /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ | ||||||
|     "module": "commonjs",                     /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ |     "module": "commonjs",                     /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ | ||||||
|  |     "lib": [ | ||||||
|  |       "es6" | ||||||
|  |     ], | ||||||
|     // "allowJs": true,                       /* Allow javascript files to be compiled. */ |     // "allowJs": true,                       /* Allow javascript files to be compiled. */ | ||||||
|     // "checkJs": true,                       /* Report errors in .js files. */ |     // "checkJs": true,                       /* Report errors in .js files. */ | ||||||
|     // "jsx": "preserve",                     /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ |     // "jsx": "preserve",                     /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ | ||||||
| @@ -45,8 +48,7 @@ | |||||||
|     // "typeRoots": [],                       /* List of folders to include type definitions from. */ |     // "typeRoots": [],                       /* List of folders to include type definitions from. */ | ||||||
|     // "types": [],                           /* Type declaration files to be included in compilation. */ |     // "types": [],                           /* Type declaration files to be included in compilation. */ | ||||||
|     // "allowSyntheticDefaultImports": true,  /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ |     // "allowSyntheticDefaultImports": true,  /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ | ||||||
|     "esModuleInterop": true,                  /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ |     "esModuleInterop": true                   /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ | ||||||
|     "sourceMap": true, |  | ||||||
|     // "preserveSymlinks": true,              /* Do not resolve the real path of symlinks. */ |     // "preserveSymlinks": true,              /* Do not resolve the real path of symlinks. */ | ||||||
|     // "allowUmdGlobalAccess": true,          /* Allow accessing UMD globals from modules. */ |     // "allowUmdGlobalAccess": true,          /* Allow accessing UMD globals from modules. */ | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user