mirror of
				https://github.com/actions/setup-go.git
				synced 2025-10-30 23:06:22 +00:00 
			
		
		
		
	mocked tests work with no internet
This commit is contained in:
		| @@ -56,14 +56,9 @@ export async function findMatch( | ||||
|   let platFilter = sys.getPlatform(); | ||||
|  | ||||
|   let match: IGoVersion | undefined; | ||||
|  | ||||
|   const dlUrl: string = 'https://golang.org/dl/?mode=json&include=all'; | ||||
|  | ||||
|   // this returns versions descending so latest is first | ||||
|   let http: httpm.HttpClient = new httpm.HttpClient('setup-go'); | ||||
|   let candidates: IGoVersion[] | null = (await http.getJson<IGoVersion[]>( | ||||
|     dlUrl | ||||
|   )).result; | ||||
|  | ||||
|   let candidates: IGoVersion[] | null = await module.exports.getVersions(dlUrl); | ||||
|   if (!candidates) { | ||||
|     throw new Error(`golang download url did not return results: ${dlUrl}`); | ||||
|   } | ||||
| @@ -98,3 +93,13 @@ export async function findMatch( | ||||
|  | ||||
|   return match; | ||||
| } | ||||
|  | ||||
| export async function getVersions(dlUrl: string): Promise<IGoVersion[] | null> { | ||||
|   // this returns versions descending so latest is first | ||||
|   let http: httpm.HttpClient = new httpm.HttpClient('setup-go');   | ||||
|   let candidates: IGoVersion[] | null = (await http.getJson<IGoVersion[]>( | ||||
|     dlUrl | ||||
|   )).result; | ||||
|  | ||||
|   return candidates; | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user