Group verbose Go installation logs and normalize package.json line endings (#789)

* refactor: enhance logging and group setup for Go version installation

* refactor: update logging group name for Go version setup

* refactor: standardize formatting in package.json

* audit fix

* update package-lock.json
This commit is contained in:
Priya Gupta
2026-09-09 00:47:06 +05:30
committed by GitHub
parent fba3fb4ead
commit addc0880c9
4 changed files with 146 additions and 134 deletions
+25 -19
View File
@@ -100576,32 +100576,38 @@ async function run() {
const versionSpec = resolveVersionInput(); const versionSpec = resolveVersionInput();
setGoToolchain(); setGoToolchain();
const cache = getBooleanInput('cache'); const cache = getBooleanInput('cache');
core_info(`Setup go version spec ${versionSpec}`);
let arch = getInput('architecture'); let arch = getInput('architecture');
if (!arch) { if (!arch) {
arch = external_os_default().arch(); arch = external_os_default().arch();
} }
if (versionSpec) { if (versionSpec) {
const token = getInput('token'); startGroup('Installed version');
const auth = !token ? undefined : `token ${token}`; try {
const checkLatest = getBooleanInput('check-latest'); core_info(`Setup go version spec ${versionSpec}`);
const goDownloadBaseUrl = getInput('go-download-base-url') || const token = getInput('token');
process.env['GO_DOWNLOAD_BASE_URL'] || const auth = !token ? undefined : `token ${token}`;
undefined; const checkLatest = getBooleanInput('check-latest');
if (goDownloadBaseUrl) { const goDownloadBaseUrl = getInput('go-download-base-url') ||
core_info(`Using custom Go download base URL: ${goDownloadBaseUrl}`); process.env['GO_DOWNLOAD_BASE_URL'] ||
undefined;
if (goDownloadBaseUrl) {
core_info(`Using custom Go download base URL: ${goDownloadBaseUrl}`);
}
const installDir = await getGo(versionSpec, checkLatest, auth, arch, goDownloadBaseUrl);
const installDirVersion = external_path_default().basename(external_path_default().dirname(installDir));
addPath(external_path_default().join(installDir, 'bin'));
core_info('Added go to the path');
const version = makeSemver(installDirVersion);
// Go versions less than 1.9 require GOROOT to be set
if (node_modules_semver.lt(version, '1.9.0')) {
core_info('Setting GOROOT for Go version < 1.9');
exportVariable('GOROOT', installDir);
}
core_info(`Successfully set up Go version ${versionSpec}`);
} }
const installDir = await getGo(versionSpec, checkLatest, auth, arch, goDownloadBaseUrl); finally {
const installDirVersion = external_path_default().basename(external_path_default().dirname(installDir)); endGroup();
addPath(external_path_default().join(installDir, 'bin'));
core_info('Added go to the path');
const version = makeSemver(installDirVersion);
// Go versions less than 1.9 require GOROOT to be set
if (node_modules_semver.lt(version, '1.9.0')) {
core_info('Setting GOROOT for Go version < 1.9');
exportVariable('GOROOT', installDir);
} }
core_info(`Successfully set up Go version ${versionSpec}`);
} }
else { else {
core_info('[warning]go-version input was not specified. The action will try to use pre-installed version.'); core_info('[warning]go-version input was not specified. The action will try to use pre-installed version.');
+23 -23
View File
@@ -2703,9 +2703,9 @@
} }
}, },
"node_modules/baseline-browser-mapping": { "node_modules/baseline-browser-mapping": {
"version": "2.10.38", "version": "2.11.20",
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.38.tgz", "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.20.tgz",
"integrity": "sha512-31/02mVB4yuQU6adKk5SlY6m+mxDwUq5KZkyYgnLrrKl7TEm1+3PyDtDBz2kOv/wxZz41GHsvV1A/u6RmiyBvw==", "integrity": "sha512-H0ulySigv6icDJ1F7SjtdCD6PrhTpdYCmP0CactWy1+ekh0AFd0o1Wn5T8b+hnTmdBx19u9yhL6wvCylXMY7zw==",
"dev": true, "dev": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"bin": { "bin": {
@@ -2728,9 +2728,9 @@
} }
}, },
"node_modules/browserslist": { "node_modules/browserslist": {
"version": "4.28.2", "version": "4.28.8",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.2.tgz", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.8.tgz",
"integrity": "sha512-48xSriZYYg+8qXna9kwqjIVzuQxi+KYWp2+5nCYnYKPTr0LvD89Jqk2Or5ogxz0NUMfIjhh2lIUX/LyX9B4oIg==", "integrity": "sha512-V2NpofLblG64mfOtSgDhOJESZEGogzDMBv/q+W6oc4LXWP/q75eOXoOaaOu1EOadB9U4Bwx/e0yzbvwKH8zalA==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@@ -2748,11 +2748,11 @@
], ],
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"baseline-browser-mapping": "^2.10.12", "baseline-browser-mapping": "^2.11.12",
"caniuse-lite": "^1.0.30001782", "caniuse-lite": "^1.0.30001809",
"electron-to-chromium": "^1.5.328", "electron-to-chromium": "^1.5.402",
"node-releases": "^2.0.36", "node-releases": "^2.0.53",
"update-browserslist-db": "^1.2.3" "update-browserslist-db": "^1.3.0"
}, },
"bin": { "bin": {
"browserslist": "cli.js" "browserslist": "cli.js"
@@ -2812,9 +2812,9 @@
} }
}, },
"node_modules/caniuse-lite": { "node_modules/caniuse-lite": {
"version": "1.0.30001799", "version": "1.0.30001810",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001799.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001810.tgz",
"integrity": "sha512-hG1bReV+OUU+MOqK4t/ZWI0tZOyz3rqS9XuhOUz1cIcbwBKjOyJEJuw9ER5JuNyqxNk8u/JUVbGibBOL1yrjFw==", "integrity": "sha512-TITQPUkaz+aVk5GL6NhOdwk1aEaNTSDPsGFWrTuhKGtjTF70jL/Oht2W4c6rXUe5fu7Ie19VIahAXHIIiWWNeg==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@@ -3093,9 +3093,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/electron-to-chromium": { "node_modules/electron-to-chromium": {
"version": "1.5.376", "version": "1.5.418",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.376.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.418.tgz",
"integrity": "sha512-cUVA7/RvbFTEuw/i3obUwDTRIXojaxkResf+ibByPFxjc6XK3VNtcQXV0NSbAlJ0FMjcJGgftVVB4Qo184EXvA==", "integrity": "sha512-UzS26r3AEbG5wSoGVpJKqwHIU9zwQN7LHdVIThDrJpS0I5KdlXFMEb8543fhc9dVnIIAST6ar8rhwa00AL5MlA==",
"dev": true, "dev": true,
"license": "ISC" "license": "ISC"
}, },
@@ -5116,9 +5116,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/node-releases": { "node_modules/node-releases": {
"version": "2.0.48", "version": "2.0.54",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.48.tgz", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.54.tgz",
"integrity": "sha512-1uz8041X6LoI6ZSdZacM9lVY28vuzDlSKitnpbSNK0RfKoIJkX29NBPVEFXhnuSuEOA9Ww0xnPJ+ILWbGAv8DA==", "integrity": "sha512-YHs7BmmcsdAI5Ozuf8JZo6PT0mv2GIWC9vMfvUC3dp65M8hn7Ux8CPL+2oBI7juNuj9d0ndhTcznq2ODBps9cQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
@@ -6239,9 +6239,9 @@
} }
}, },
"node_modules/update-browserslist-db": { "node_modules/update-browserslist-db": {
"version": "1.2.3", "version": "1.3.2",
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.2.tgz",
"integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==", "integrity": "sha512-UQ+MSxlhRm1bzjhU+DcuXfjFO1FzNtqhK5+9Yvlp90ItDLk5vT932A0rFu619nf7RVS+Y/VeaUW1jaRDqZ8VJw==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
+60 -60
View File
@@ -1,60 +1,60 @@
{ {
"name": "setup-go", "name": "setup-go",
"version": "7.0.0", "version": "7.0.0",
"type": "module", "type": "module",
"private": true, "private": true,
"description": "setup go action", "description": "setup go action",
"main": "lib/setup-go.js", "main": "lib/setup-go.js",
"engines": { "engines": {
"node": ">=24.0.0" "node": ">=24.0.0"
}, },
"scripts": { "scripts": {
"build": "tsc && ncc build -o dist/setup src/setup-go.ts && ncc build -o dist/cache-save src/cache-save.ts", "build": "tsc && ncc build -o dist/setup src/setup-go.ts && ncc build -o dist/cache-save src/cache-save.ts",
"format": "prettier --no-error-on-unmatched-pattern --write \"**/*.{ts,yml,yaml}\"", "format": "prettier --no-error-on-unmatched-pattern --write \"**/*.{ts,yml,yaml}\"",
"format-check": "prettier --no-error-on-unmatched-pattern --check \"**/*.{ts,yml,yaml}\"", "format-check": "prettier --no-error-on-unmatched-pattern --check \"**/*.{ts,yml,yaml}\"",
"lint": "eslint \"**/*.ts\"", "lint": "eslint \"**/*.ts\"",
"lint:fix": "eslint \"**/*.ts\" --fix", "lint:fix": "eslint \"**/*.ts\" --fix",
"test": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --runInBand --coverage", "test": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --runInBand --coverage",
"pre-checkin": "npm run format && npm run lint:fix && npm run build && npm test" "pre-checkin": "npm run format && npm run lint:fix && npm run build && npm test"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/actions/setup-go.git" "url": "git+https://github.com/actions/setup-go.git"
}, },
"keywords": [ "keywords": [
"actions", "actions",
"go", "go",
"setup" "setup"
], ],
"author": "GitHub", "author": "GitHub",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/cache": "^6.2.0", "@actions/cache": "^6.2.0",
"@actions/core": "^3.0.1", "@actions/core": "^3.0.1",
"@actions/exec": "^3.0.0", "@actions/exec": "^3.0.0",
"@actions/glob": "^0.7.0", "@actions/glob": "^0.7.0",
"@actions/http-client": "^4.0.1", "@actions/http-client": "^4.0.1",
"@actions/io": "^3.0.2", "@actions/io": "^3.0.2",
"@actions/tool-cache": "^4.0.0", "@actions/tool-cache": "^4.0.0",
"semver": "^7.8.5" "semver": "^7.8.5"
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "^10.0.1", "@eslint/js": "^10.0.1",
"@jest/globals": "^30.4.1", "@jest/globals": "^30.4.1",
"@types/node": "^24.0.0", "@types/node": "^24.0.0",
"@types/semver": "^7.7.0", "@types/semver": "^7.7.0",
"@typescript-eslint/eslint-plugin": "^8.62.0", "@typescript-eslint/eslint-plugin": "^8.62.0",
"@typescript-eslint/parser": "^8.62.0", "@typescript-eslint/parser": "^8.62.0",
"@vercel/ncc": "^0.44.0", "@vercel/ncc": "^0.44.0",
"eslint": "^10.5.0", "eslint": "^10.5.0",
"eslint-config-prettier": "^10.0.0", "eslint-config-prettier": "^10.0.0",
"eslint-plugin-jest": "^29.15.2", "eslint-plugin-jest": "^29.15.2",
"eslint-plugin-n": "^18.1.0", "eslint-plugin-n": "^18.1.0",
"globals": "^17.7.0", "globals": "^17.7.0",
"jest": "^30.4.2", "jest": "^30.4.2",
"nock": "^14.0.0", "nock": "^14.0.0",
"prettier": "^3.8.4", "prettier": "^3.8.4",
"ts-jest": "^29.4.11", "ts-jest": "^29.4.11",
"typescript": "^6.0.3" "typescript": "^6.0.3"
} }
} }
+38 -32
View File
@@ -21,7 +21,6 @@ export async function run() {
setGoToolchain(); setGoToolchain();
const cache = core.getBooleanInput('cache'); const cache = core.getBooleanInput('cache');
core.info(`Setup go version spec ${versionSpec}`);
let arch = core.getInput('architecture') as Architecture; let arch = core.getInput('architecture') as Architecture;
@@ -30,41 +29,48 @@ export async function run() {
} }
if (versionSpec) { if (versionSpec) {
const token = core.getInput('token'); core.startGroup('Installed version');
const auth = !token ? undefined : `token ${token}`; try {
core.info(`Setup go version spec ${versionSpec}`);
const checkLatest = core.getBooleanInput('check-latest'); const token = core.getInput('token');
const auth = !token ? undefined : `token ${token}`;
const goDownloadBaseUrl = const checkLatest = core.getBooleanInput('check-latest');
core.getInput('go-download-base-url') ||
process.env['GO_DOWNLOAD_BASE_URL'] ||
undefined;
if (goDownloadBaseUrl) { const goDownloadBaseUrl =
core.info(`Using custom Go download base URL: ${goDownloadBaseUrl}`); core.getInput('go-download-base-url') ||
process.env['GO_DOWNLOAD_BASE_URL'] ||
undefined;
if (goDownloadBaseUrl) {
core.info(`Using custom Go download base URL: ${goDownloadBaseUrl}`);
}
const installDir = await installer.getGo(
versionSpec,
checkLatest,
auth,
arch,
goDownloadBaseUrl
);
const installDirVersion = path.basename(path.dirname(installDir));
core.addPath(path.join(installDir, 'bin'));
core.info('Added go to the path');
const version = installer.makeSemver(installDirVersion);
// Go versions less than 1.9 require GOROOT to be set
if (semver.lt(version, '1.9.0')) {
core.info('Setting GOROOT for Go version < 1.9');
core.exportVariable('GOROOT', installDir);
}
core.info(`Successfully set up Go version ${versionSpec}`);
} finally {
core.endGroup();
} }
const installDir = await installer.getGo(
versionSpec,
checkLatest,
auth,
arch,
goDownloadBaseUrl
);
const installDirVersion = path.basename(path.dirname(installDir));
core.addPath(path.join(installDir, 'bin'));
core.info('Added go to the path');
const version = installer.makeSemver(installDirVersion);
// Go versions less than 1.9 require GOROOT to be set
if (semver.lt(version, '1.9.0')) {
core.info('Setting GOROOT for Go version < 1.9');
core.exportVariable('GOROOT', installDir);
}
core.info(`Successfully set up Go version ${versionSpec}`);
} else { } else {
core.info( core.info(
'[warning]go-version input was not specified. The action will try to use pre-installed version.' '[warning]go-version input was not specified. The action will try to use pre-installed version.'