mirror of
https://github.com/actions/setup-go.git
synced 2025-09-08 11:13:38 -06:00
Node 24 upgrade (#624)
* Node 24 upgrade Doing an upgrade for node 24, node 24 is stricter with types so need to add a type for achitecture * format * package updates * fix for check failures * upgrade @types/node * update package.json version * check failure fix * package-lock.json update * update node24 * npm run format * npm run format * node update from the workflows * Upgrade `actions/checkout` to v5 and `actions/setup-go` to v6 in README.md --------- Co-authored-by: Aparna Jyothi <aparnajyothi-y@github.com> Co-authored-by: Priya Gupta <147705955+priyagupta108@users.noreply.github.com>
This commit is contained in:
parent
1d76b952eb
commit
e093d1e9bb
11 changed files with 67 additions and 49 deletions
|
@ -7,6 +7,7 @@ import * as sys from './system';
|
|||
import fs from 'fs';
|
||||
import os from 'os';
|
||||
import {StableReleaseAlias, isSelfHosted} from './utils';
|
||||
import {Architecture} from './types';
|
||||
|
||||
export const GOTOOLCHAIN_ENV_VAR = 'GOTOOLCHAIN';
|
||||
export const GOTOOLCHAIN_LOCAL_VAL = 'local';
|
||||
|
@ -41,7 +42,7 @@ export async function getGo(
|
|||
versionSpec: string,
|
||||
checkLatest: boolean,
|
||||
auth: string | undefined,
|
||||
arch = os.arch()
|
||||
arch: Architecture = os.arch() as Architecture
|
||||
) {
|
||||
let manifest: tc.IToolRelease[] | undefined;
|
||||
const osPlat: string = os.platform();
|
||||
|
@ -153,7 +154,7 @@ async function resolveVersionFromManifest(
|
|||
versionSpec: string,
|
||||
stable: boolean,
|
||||
auth: string | undefined,
|
||||
arch: string,
|
||||
arch: Architecture,
|
||||
manifest: tc.IToolRelease[] | undefined
|
||||
): Promise<string | undefined> {
|
||||
try {
|
||||
|
@ -355,7 +356,7 @@ export async function getInfoFromManifest(
|
|||
versionSpec: string,
|
||||
stable: boolean,
|
||||
auth: string | undefined,
|
||||
arch = os.arch(),
|
||||
arch: Architecture = os.arch() as Architecture,
|
||||
manifest?: tc.IToolRelease[] | undefined
|
||||
): Promise<IGoVersionInfo | null> {
|
||||
let info: IGoVersionInfo | null = null;
|
||||
|
@ -381,7 +382,7 @@ export async function getInfoFromManifest(
|
|||
|
||||
async function getInfoFromDist(
|
||||
versionSpec: string,
|
||||
arch: string
|
||||
arch: Architecture
|
||||
): Promise<IGoVersionInfo | null> {
|
||||
const version: IGoVersion | undefined = await findMatch(versionSpec, arch);
|
||||
if (!version) {
|
||||
|
@ -400,7 +401,7 @@ async function getInfoFromDist(
|
|||
|
||||
export async function findMatch(
|
||||
versionSpec: string,
|
||||
arch = os.arch()
|
||||
arch: Architecture = os.arch() as Architecture
|
||||
): Promise<IGoVersion | undefined> {
|
||||
const archFilter = sys.getArch(arch);
|
||||
const platFilter = sys.getPlatform();
|
||||
|
@ -517,7 +518,10 @@ export function parseGoVersionFile(versionFilePath: string): string {
|
|||
return contents.trim();
|
||||
}
|
||||
|
||||
async function resolveStableVersionDist(versionSpec: string, arch: string) {
|
||||
async function resolveStableVersionDist(
|
||||
versionSpec: string,
|
||||
arch: Architecture
|
||||
) {
|
||||
const archFilter = sys.getArch(arch);
|
||||
const platFilter = sys.getPlatform();
|
||||
const dlUrl = 'https://golang.org/dl/?mode=json&include=all';
|
||||
|
|
|
@ -8,6 +8,7 @@ import {isCacheFeatureAvailable} from './cache-utils';
|
|||
import cp from 'child_process';
|
||||
import fs from 'fs';
|
||||
import os from 'os';
|
||||
import {Architecture} from './types';
|
||||
|
||||
export async function run() {
|
||||
try {
|
||||
|
@ -21,10 +22,10 @@ export async function run() {
|
|||
const cache = core.getBooleanInput('cache');
|
||||
core.info(`Setup go version spec ${versionSpec}`);
|
||||
|
||||
let arch = core.getInput('architecture');
|
||||
let arch = core.getInput('architecture') as Architecture;
|
||||
|
||||
if (!arch) {
|
||||
arch = os.arch();
|
||||
arch = os.arch() as Architecture;
|
||||
}
|
||||
|
||||
if (versionSpec) {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import os from 'os';
|
||||
import {Architecture} from './types';
|
||||
|
||||
export function getPlatform(): string {
|
||||
// darwin and linux match already
|
||||
|
@ -15,7 +16,7 @@ export function getPlatform(): string {
|
|||
return plat;
|
||||
}
|
||||
|
||||
export function getArch(arch: string): string {
|
||||
export function getArch(arch: Architecture): string {
|
||||
// 'arm', 'arm64', 'ia32', 'mips', 'mipsel', 'ppc', 'ppc64', 's390', 's390x', 'x32', and 'x64'.
|
||||
|
||||
// wants amd64, 386, arm64, armv61, ppc641e, s390x
|
||||
|
|
2
src/types.ts
Normal file
2
src/types.ts
Normal file
|
@ -0,0 +1,2 @@
|
|||
// match what @actions/tool-cache expects
|
||||
export type Architecture = string;
|
Loading…
Add table
Add a link
Reference in a new issue