From 65f08372d66c40a23fd19c3f59ced7873e82b927 Mon Sep 17 00:00:00 2001 From: Masahiro Furudate <178inaba.git@gmail.com> Date: Sat, 6 Apr 2024 03:00:41 +0900 Subject: [PATCH 1/4] Fix golang download url to go.dev --- src/installer.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/installer.ts b/src/installer.ts index 1b5f20f..8b1c93b 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -15,6 +15,8 @@ const MANIFEST_URL = `https://raw.githubusercontent.com/${MANIFEST_REPO_OWNER}/$ type InstallationType = 'dist' | 'manifest'; +const golangDownloadUrl = 'https://go.dev/dl/?mode=json&include=all'; + export interface IGoVersionFile { filename: string; // darwin, linux, windows @@ -406,9 +408,8 @@ export async function findMatch( let result: IGoVersion | undefined; let match: IGoVersion | undefined; - const dlUrl = 'https://golang.org/dl/?mode=json&include=all'; const candidates: IGoVersion[] | null = await module.exports.getVersionsDist( - dlUrl + golangDownloadUrl ); if (!candidates) { throw new Error(`golang download url did not return results`); @@ -505,9 +506,8 @@ export function parseGoVersionFile(versionFilePath: string): string { async function resolveStableVersionDist(versionSpec: string, arch: string) { const archFilter = sys.getArch(arch); const platFilter = sys.getPlatform(); - const dlUrl = 'https://golang.org/dl/?mode=json&include=all'; const candidates: IGoVersion[] | null = await module.exports.getVersionsDist( - dlUrl + golangDownloadUrl ); if (!candidates) { throw new Error(`golang download url did not return results`); From 5eedbcc4c8485ab6b92755ff328da96619fc5daf Mon Sep 17 00:00:00 2001 From: Masahiro Furudate <178inaba.git@gmail.com> Date: Sat, 13 Apr 2024 23:44:39 +0900 Subject: [PATCH 2/4] Fix const name --- src/installer.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/installer.ts b/src/installer.ts index 8b1c93b..c340b02 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -15,7 +15,7 @@ const MANIFEST_URL = `https://raw.githubusercontent.com/${MANIFEST_REPO_OWNER}/$ type InstallationType = 'dist' | 'manifest'; -const golangDownloadUrl = 'https://go.dev/dl/?mode=json&include=all'; +const GOLANG_DOWNLOAD_URL = 'https://go.dev/dl/?mode=json&include=all'; export interface IGoVersionFile { filename: string; @@ -409,7 +409,7 @@ export async function findMatch( let match: IGoVersion | undefined; const candidates: IGoVersion[] | null = await module.exports.getVersionsDist( - golangDownloadUrl + GOLANG_DOWNLOAD_URL ); if (!candidates) { throw new Error(`golang download url did not return results`); @@ -507,7 +507,7 @@ async function resolveStableVersionDist(versionSpec: string, arch: string) { const archFilter = sys.getArch(arch); const platFilter = sys.getPlatform(); const candidates: IGoVersion[] | null = await module.exports.getVersionsDist( - golangDownloadUrl + GOLANG_DOWNLOAD_URL ); if (!candidates) { throw new Error(`golang download url did not return results`); From c874788d3c5a37303686228d289d6451dd90b0e6 Mon Sep 17 00:00:00 2001 From: Masahiro Furudate <178inaba.git@gmail.com> Date: Sat, 13 Apr 2024 23:46:49 +0900 Subject: [PATCH 3/4] Run `npm run build` --- dist/setup/index.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index ffccd09..5ea2fb4 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -93304,6 +93304,7 @@ const MANIFEST_REPO_OWNER = 'actions'; const MANIFEST_REPO_NAME = 'go-versions'; 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 GOLANG_DOWNLOAD_URL = 'https://go.dev/dl/?mode=json&include=all'; function getGo(versionSpec_1, checkLatest_1, auth_1) { return __awaiter(this, arguments, void 0, function* (versionSpec, checkLatest, auth, arch = os_1.default.arch()) { var _a; @@ -93569,8 +93570,7 @@ function findMatch(versionSpec_1) { const platFilter = sys.getPlatform(); let result; let match; - const dlUrl = 'https://golang.org/dl/?mode=json&include=all'; - const candidates = yield module.exports.getVersionsDist(dlUrl); + const candidates = yield module.exports.getVersionsDist(GOLANG_DOWNLOAD_URL); if (!candidates) { throw new Error(`golang download url did not return results`); } @@ -93650,8 +93650,7 @@ function resolveStableVersionDist(versionSpec, arch) { return __awaiter(this, void 0, void 0, function* () { const archFilter = sys.getArch(arch); const platFilter = sys.getPlatform(); - const dlUrl = 'https://golang.org/dl/?mode=json&include=all'; - const candidates = yield module.exports.getVersionsDist(dlUrl); + const candidates = yield module.exports.getVersionsDist(GOLANG_DOWNLOAD_URL); if (!candidates) { throw new Error(`golang download url did not return results`); } From daa46e9a61f107078190dd1a1f7b8d5a2fd15f9e Mon Sep 17 00:00:00 2001 From: Masahiro Furudate <178inaba.git@gmail.com> Date: Thu, 18 Apr 2024 23:57:07 +0900 Subject: [PATCH 4/4] Fix README Fix `golang.org` to `go.dev`. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b23585d..9e427ee 100644 --- a/README.md +++ b/README.md @@ -197,7 +197,7 @@ The `go` directive in `go.mod` can specify a patch version or omit it altogether If a patch version is specified, that specific patch version will be used. If no patch version is specified, it will search for the latest available patch version in the cache, [versions-manifest.json](https://github.com/actions/go-versions/blob/main/versions-manifest.json), and the -[official Go language website](https://golang.org/dl/?mode=json&include=all), in that order. +[official Go language website](https://go.dev/dl/?mode=json&include=all), in that order. If both the `go-version` and the `go-version-file` inputs are provided then the `go-version` input is used. > The action will search for the `go.mod` file relative to the repository root