mirror of
https://github.com/actions/setup-go.git
synced 2026-04-24 06:04:25 +00:00
fixup
This commit is contained in:
parent
e937024ae6
commit
3efc8fd0e3
3 changed files with 27687 additions and 133 deletions
|
|
@ -1465,9 +1465,7 @@ use .
|
||||||
'The requested Go version 1.25.0 is not available for platform linux/arm64'
|
'The requested Go version 1.25.0 is not available for platform linux/arm64'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
expect(cnSpy).toHaveBeenCalledWith(
|
expect(cnSpy).toHaveBeenCalledWith(expect.stringContaining('HTTP 404'));
|
||||||
expect.stringContaining('HTTP 404')
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('shows clear error with platform/arch and URL on download failure', async () => {
|
it('shows clear error with platform/arch and URL on download failure', async () => {
|
||||||
|
|
|
||||||
27795
dist/setup/index.js
vendored
27795
dist/setup/index.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -17,7 +17,6 @@ const MANIFEST_REPO_NAME = 'go-versions';
|
||||||
const MANIFEST_REPO_BRANCH = 'main';
|
const MANIFEST_REPO_BRANCH = 'main';
|
||||||
const MANIFEST_URL = `https://raw.githubusercontent.com/${MANIFEST_REPO_OWNER}/${MANIFEST_REPO_NAME}/${MANIFEST_REPO_BRANCH}/versions-manifest.json`;
|
const MANIFEST_URL = `https://raw.githubusercontent.com/${MANIFEST_REPO_OWNER}/${MANIFEST_REPO_NAME}/${MANIFEST_REPO_BRANCH}/versions-manifest.json`;
|
||||||
const DEFAULT_GO_DOWNLOAD_BASE_URL = 'https://go.dev/dl';
|
const DEFAULT_GO_DOWNLOAD_BASE_URL = 'https://go.dev/dl';
|
||||||
const DEFAULT_GO_VERSIONS_URL = 'https://golang.org/dl/?mode=json&include=all';
|
|
||||||
|
|
||||||
type InstallationType = 'dist' | 'manifest';
|
type InstallationType = 'dist' | 'manifest';
|
||||||
|
|
||||||
|
|
@ -143,12 +142,7 @@ export async function getGo(
|
||||||
|
|
||||||
try {
|
try {
|
||||||
core.info('Install from custom download URL');
|
core.info('Install from custom download URL');
|
||||||
downloadPath = await installGoVersion(
|
downloadPath = await installGoVersion(info, auth, arch, toolCacheName);
|
||||||
info,
|
|
||||||
auth,
|
|
||||||
arch,
|
|
||||||
toolCacheName
|
|
||||||
);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const downloadUrl = info?.downloadUrl || customBaseUrl;
|
const downloadUrl = info?.downloadUrl || customBaseUrl;
|
||||||
if (err instanceof tc.HTTPError && err.httpStatusCode === 404) {
|
if (err instanceof tc.HTTPError && err.httpStatusCode === 404) {
|
||||||
|
|
@ -484,11 +478,7 @@ async function getInfoFromDist(
|
||||||
arch: Architecture,
|
arch: Architecture,
|
||||||
goDownloadBaseUrl?: string
|
goDownloadBaseUrl?: string
|
||||||
): Promise<IGoVersionInfo | null> {
|
): Promise<IGoVersionInfo | null> {
|
||||||
const version: IGoVersion | undefined = await findMatch(
|
const version: IGoVersion | undefined = await findMatch(versionSpec, arch);
|
||||||
versionSpec,
|
|
||||||
arch,
|
|
||||||
goDownloadBaseUrl
|
|
||||||
);
|
|
||||||
if (!version) {
|
if (!version) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -539,8 +529,7 @@ export function getInfoFromDirectDownload(
|
||||||
|
|
||||||
export async function findMatch(
|
export async function findMatch(
|
||||||
versionSpec: string,
|
versionSpec: string,
|
||||||
arch: Architecture = os.arch() as Architecture,
|
arch: Architecture = os.arch() as Architecture
|
||||||
goDownloadBaseUrl?: string
|
|
||||||
): Promise<IGoVersion | undefined> {
|
): Promise<IGoVersion | undefined> {
|
||||||
const archFilter = sys.getArch(arch);
|
const archFilter = sys.getArch(arch);
|
||||||
const platFilter = sys.getPlatform();
|
const platFilter = sys.getPlatform();
|
||||||
|
|
@ -548,9 +537,6 @@ export async function findMatch(
|
||||||
let result: IGoVersion | undefined;
|
let result: IGoVersion | undefined;
|
||||||
let match: IGoVersion | undefined;
|
let match: IGoVersion | undefined;
|
||||||
|
|
||||||
const dlUrl = goDownloadBaseUrl
|
|
||||||
? `${goDownloadBaseUrl}/?mode=json&include=all`
|
|
||||||
: DEFAULT_GO_VERSIONS_URL;
|
|
||||||
const candidates: IGoVersion[] | null = await module.exports.getVersionsDist(
|
const candidates: IGoVersion[] | null = await module.exports.getVersionsDist(
|
||||||
GOLANG_DOWNLOAD_URL
|
GOLANG_DOWNLOAD_URL
|
||||||
);
|
);
|
||||||
|
|
@ -668,7 +654,6 @@ async function resolveStableVersionDist(
|
||||||
) {
|
) {
|
||||||
const archFilter = sys.getArch(arch);
|
const archFilter = sys.getArch(arch);
|
||||||
const platFilter = sys.getPlatform();
|
const platFilter = sys.getPlatform();
|
||||||
const dlUrl = DEFAULT_GO_VERSIONS_URL;
|
|
||||||
const candidates: IGoVersion[] | null = await module.exports.getVersionsDist(
|
const candidates: IGoVersion[] | null = await module.exports.getVersionsDist(
|
||||||
GOLANG_DOWNLOAD_URL
|
GOLANG_DOWNLOAD_URL
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue