mirror of
				https://github.com/actions/setup-go.git
				synced 2025-10-30 23:10:30 +00:00 
			
		
		
		
	Add support for .tool-versions file in setup-go, update workflow (#673)
* setup go in local * add .tool-versions file support
This commit is contained in:
		
							
								
								
									
										1
									
								
								__tests__/data/.tool-versions
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								__tests__/data/.tool-versions
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| golang 1.23.2 | ||||
| @@ -866,6 +866,9 @@ exclude example.com/thismodule v1.3.0 | ||||
|  | ||||
| use . | ||||
|  | ||||
| `; | ||||
|  | ||||
|     const toolVersionsContents = `golang 1.23 | ||||
| `; | ||||
|  | ||||
|     it('reads version from go.mod', async () => { | ||||
| @@ -892,6 +895,18 @@ use . | ||||
|       expect(logSpy).toHaveBeenCalledWith('matching 1.19...'); | ||||
|     }); | ||||
|  | ||||
|     it('reads version from .tool-versions', async () => { | ||||
|       inputs['go-version-file'] = '.tool-versions'; | ||||
|       existsSpy.mockImplementation(() => true); | ||||
|       readFileSpy.mockImplementation(() => Buffer.from(toolVersionsContents)); | ||||
|  | ||||
|       await main.run(); | ||||
|  | ||||
|       expect(logSpy).toHaveBeenCalledWith('Setup go version spec 1.23'); | ||||
|       expect(logSpy).toHaveBeenCalledWith('Attempting to download 1.23...'); | ||||
|       expect(logSpy).toHaveBeenCalledWith('matching 1.23...'); | ||||
|     }); | ||||
|  | ||||
|     it('reads version from .go-version', async () => { | ||||
|       inputs['go-version-file'] = '.go-version'; | ||||
|       existsSpy.mockImplementation(() => true); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 priya-kinthali
					priya-kinthali