mirror of
https://github.com/actions/setup-go.git
synced 2026-03-14 22:55:45 +01:00
fix bug in JSON with custom URL
This commit is contained in:
parent
9142921940
commit
0980fb1938
3 changed files with 21 additions and 6 deletions
|
|
@ -1136,6 +1136,10 @@ use .
|
|||
`Using custom Go download base URL: ${customBaseUrl}`
|
||||
);
|
||||
expect(logSpy).toHaveBeenCalledWith('Install from custom download URL');
|
||||
// Version listing should use custom base URL, not go.dev
|
||||
expect(getSpy).toHaveBeenCalledWith(
|
||||
`${customBaseUrl}/?mode=json&include=all`
|
||||
);
|
||||
expect(dlSpy).toHaveBeenCalled();
|
||||
expect(extractTarSpy).toHaveBeenCalled();
|
||||
expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`);
|
||||
|
|
|
|||
9
dist/setup/index.js
vendored
9
dist/setup/index.js
vendored
|
|
@ -77383,7 +77383,10 @@ function getInfoFromManifest(versionSpec_1, stable_1, auth_1) {
|
|||
}
|
||||
function getInfoFromDist(versionSpec, arch, goDownloadBaseUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const version = yield findMatch(versionSpec, arch);
|
||||
const dlUrl = goDownloadBaseUrl
|
||||
? `${goDownloadBaseUrl}/?mode=json&include=all`
|
||||
: GOLANG_DOWNLOAD_URL;
|
||||
const version = yield findMatch(versionSpec, arch, dlUrl);
|
||||
if (!version) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -77421,12 +77424,12 @@ function getInfoFromDirectDownload(versionSpec, arch, goDownloadBaseUrl) {
|
|||
};
|
||||
}
|
||||
function findMatch(versionSpec_1) {
|
||||
return __awaiter(this, arguments, void 0, function* (versionSpec, arch = os_1.default.arch()) {
|
||||
return __awaiter(this, arguments, void 0, function* (versionSpec, arch = os_1.default.arch(), dlUrl = GOLANG_DOWNLOAD_URL) {
|
||||
const archFilter = sys.getArch(arch);
|
||||
const platFilter = sys.getPlatform();
|
||||
let result;
|
||||
let match;
|
||||
const candidates = yield module.exports.getVersionsDist(GOLANG_DOWNLOAD_URL);
|
||||
const candidates = yield module.exports.getVersionsDist(dlUrl);
|
||||
if (!candidates) {
|
||||
throw new Error(`golang download url did not return results`);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -502,7 +502,14 @@ async function getInfoFromDist(
|
|||
arch: Architecture,
|
||||
goDownloadBaseUrl?: string
|
||||
): Promise<IGoVersionInfo | null> {
|
||||
const version: IGoVersion | undefined = await findMatch(versionSpec, arch);
|
||||
const dlUrl = goDownloadBaseUrl
|
||||
? `${goDownloadBaseUrl}/?mode=json&include=all`
|
||||
: GOLANG_DOWNLOAD_URL;
|
||||
const version: IGoVersion | undefined = await findMatch(
|
||||
versionSpec,
|
||||
arch,
|
||||
dlUrl
|
||||
);
|
||||
if (!version) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -553,7 +560,8 @@ export function getInfoFromDirectDownload(
|
|||
|
||||
export async function findMatch(
|
||||
versionSpec: string,
|
||||
arch: Architecture = os.arch() as Architecture
|
||||
arch: Architecture = os.arch() as Architecture,
|
||||
dlUrl: string = GOLANG_DOWNLOAD_URL
|
||||
): Promise<IGoVersion | undefined> {
|
||||
const archFilter = sys.getArch(arch);
|
||||
const platFilter = sys.getPlatform();
|
||||
|
|
@ -562,7 +570,7 @@ export async function findMatch(
|
|||
let match: IGoVersion | undefined;
|
||||
|
||||
const candidates: IGoVersion[] | null = await module.exports.getVersionsDist(
|
||||
GOLANG_DOWNLOAD_URL
|
||||
dlUrl
|
||||
);
|
||||
if (!candidates) {
|
||||
throw new Error(`golang download url did not return results`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue