Compare commits

...

6 Commits

Author SHA1 Message Date
Masahiro Furudate 877c4f3f9a
Merge c86b535f9f into b26d40294f 2024-09-06 13:16:34 -05:00
Zxilly b26d40294f
fix: add arch to cache key (#493) 2024-08-26 15:19:57 -05:00
Masahiro Furudate c86b535f9f Fix README
Fix `golang.org` to `go.dev`.
2024-04-18 23:57:07 +09:00
Masahiro Furudate d55cd80f9a Run `npm run build` 2024-04-18 23:52:41 +09:00
Masahiro Furudate b31a50ec78 Fix const name 2024-04-18 23:52:40 +09:00
Masahiro Furudate 6e0245c608 Fix golang download url to go.dev 2024-04-18 23:52:40 +09:00
4 changed files with 12 additions and 11 deletions

View File

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

10
dist/setup/index.js vendored
View File

@ -88045,6 +88045,7 @@ const cache_utils_1 = __nccwpck_require__(1678);
const restoreCache = (versionSpec, packageManager, cacheDependencyPath) => __awaiter(void 0, void 0, void 0, function* () {
const packageManagerInfo = yield (0, cache_utils_1.getPackageManagerInfo)(packageManager);
const platform = process.env.RUNNER_OS;
const arch = process.arch;
const cachePaths = yield (0, cache_utils_1.getCacheDirectoryPath)(packageManagerInfo);
const dependencyFilePath = cacheDependencyPath
? cacheDependencyPath
@ -88054,7 +88055,7 @@ const restoreCache = (versionSpec, packageManager, cacheDependencyPath) => __awa
throw new Error('Some specified paths were not resolved, unable to cache dependencies.');
}
const linuxVersion = process.env.RUNNER_OS === 'Linux' ? `${process.env.ImageOS}-` : '';
const primaryKey = `setup-go-${platform}-${linuxVersion}go-${versionSpec}-${fileHash}`;
const primaryKey = `setup-go-${platform}-${arch}-${linuxVersion}go-${versionSpec}-${fileHash}`;
core.debug(`primary key is ${primaryKey}`);
core.saveState(constants_1.State.CachePrimaryKey, primaryKey);
const cacheKey = yield cache.restoreCache(cachePaths, primaryKey);
@ -88254,6 +88255,7 @@ const sys = __importStar(__nccwpck_require__(5632));
const fs_1 = __importDefault(__nccwpck_require__(7147));
const os_1 = __importDefault(__nccwpck_require__(2037));
const utils_1 = __nccwpck_require__(1314);
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;
@ -88473,8 +88475,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`);
}
@ -88554,8 +88555,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`);
}

View File

@ -15,6 +15,7 @@ export const restoreCache = async (
) => {
const packageManagerInfo = await getPackageManagerInfo(packageManager);
const platform = process.env.RUNNER_OS;
const arch = process.arch;
const cachePaths = await getCacheDirectoryPath(packageManagerInfo);
@ -31,7 +32,7 @@ export const restoreCache = async (
const linuxVersion =
process.env.RUNNER_OS === 'Linux' ? `${process.env.ImageOS}-` : '';
const primaryKey = `setup-go-${platform}-${linuxVersion}go-${versionSpec}-${fileHash}`;
const primaryKey = `setup-go-${platform}-${arch}-${linuxVersion}go-${versionSpec}-${fileHash}`;
core.debug(`primary key is ${primaryKey}`);
core.saveState(State.CachePrimaryKey, primaryKey);

View File

@ -10,6 +10,8 @@ import {StableReleaseAlias} from './utils';
type InstallationType = 'dist' | 'manifest';
const GOLANG_DOWNLOAD_URL = 'https://go.dev/dl/?mode=json&include=all';
export interface IGoVersionFile {
filename: string;
// darwin, linux, windows
@ -335,9 +337,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
GOLANG_DOWNLOAD_URL
);
if (!candidates) {
throw new Error(`golang download url did not return results`);
@ -434,9 +435,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
GOLANG_DOWNLOAD_URL
);
if (!candidates) {
throw new Error(`golang download url did not return results`);