Files
setup-go/src/system.ts
Priya Gupta 0778a10ce4 Migrate to ESM and upgrade dependencies (#763)
* Migrate to ESM and upgrade dependencies

* Remove unused tsconfig.eslint.json

* bump version to 7.0.0 in package.json and package-lock.json

* Add ESM migration note to README for V7

* Remove unnecessary devDependencies: ts-node, @types/jest

* npm audit fix

* Update README with ESM migration details

Clarified migration details to ESM for action compatibility.

* Downgrade @types/node to ^24, clean up tsconfig and README.
2026-07-15 15:34:36 -05:00

41 lines
948 B
TypeScript

import os from 'os';
import {Architecture} from './types.js';
export function getPlatform(): string {
// darwin and linux match already
// freebsd not supported yet but future proofed.
// 'aix', 'darwin', 'freebsd', 'linux', 'openbsd', 'sunos', and 'win32'
let plat: string = os.platform();
// wants 'darwin', 'freebsd', 'linux', 'windows'
if (plat === 'win32') {
plat = 'windows';
}
return plat;
}
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
// currently not supported by runner but future proofed mapping
switch (arch) {
case 'x64':
arch = 'amd64';
break;
// case 'ppc':
// arch = 'ppc64';
// break;
case 'x32':
arch = '386';
break;
case 'arm':
arch = 'armv6l';
break;
}
return arch;
}