|
|
|
@ -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
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|