From c8bd090a3e2fe05c87330e9341affadc58611218 Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Wed, 8 Mar 2023 13:36:44 +0100 Subject: [PATCH 1/3] add go bin even if go-version is empty --- dist/setup/index.js | 6 +++--- src/main.ts | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index b1fe2cad7..0864b681a 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -63596,10 +63596,10 @@ function run() { core.info('Setting GOROOT for Go version < 1.9'); core.exportVariable('GOROOT', installDir); } - const added = yield addBinToPath(); - core.debug(`add bin ${added}`); - core.info(`Successfully set up Go version ${versionSpec}`); } + const added = yield addBinToPath(); + core.debug(`add bin ${added}`); + core.info(`Successfully set up Go version ${versionSpec}`); const goPath = yield io.which('go'); const goVersion = (child_process_1.default.execSync(`${goPath} version`) || '').toString(); if (cache && cache_utils_1.isCacheFeatureAvailable()) { diff --git a/src/main.ts b/src/main.ts index 82fc54007..5c76f702c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -50,12 +50,12 @@ export async function run() { core.info('Setting GOROOT for Go version < 1.9'); core.exportVariable('GOROOT', installDir); } - - const added = await addBinToPath(); - core.debug(`add bin ${added}`); - core.info(`Successfully set up Go version ${versionSpec}`); } + const added = await addBinToPath(); + core.debug(`add bin ${added}`); + core.info(`Successfully set up Go version ${versionSpec}`); + const goPath = await io.which('go'); const goVersion = (cp.execSync(`${goPath} version`) || '').toString(); From 90a3d02a0cce48e2b2c4eb533504b39ce7f82db1 Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Tue, 14 Mar 2023 16:15:07 +0100 Subject: [PATCH 2/3] rebuild --- dist/setup/index.js | 25 +++++++++++++++++++++---- src/main.ts | 3 ++- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 0864b681a..f298d5c32 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -63130,8 +63130,17 @@ const getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, void }); exports.getPackageManagerInfo = getPackageManagerInfo; const getCacheDirectoryPath = (packageManagerInfo) => __awaiter(void 0, void 0, void 0, function* () { - const pathList = yield Promise.all(packageManagerInfo.cacheFolderCommandList.map((command) => __awaiter(void 0, void 0, void 0, function* () { return exports.getCommandOutput(command); }))); - const cachePaths = pathList.filter(item => item); + const pathOutputs = yield Promise.allSettled(packageManagerInfo.cacheFolderCommandList.map((command) => __awaiter(void 0, void 0, void 0, function* () { return exports.getCommandOutput(command); }))); + const results = pathOutputs.map(item => { + if (item.status === 'fulfilled') { + return item.value; + } + else { + core.info(`[warning]getting cache directory path failed: ${item.reason}`); + } + return ''; + }); + const cachePaths = results.filter(item => item); if (!cachePaths.length) { throw new Error(`Could not get cache folder paths.`); } @@ -63596,16 +63605,24 @@ function run() { core.info('Setting GOROOT for Go version < 1.9'); core.exportVariable('GOROOT', installDir); } + core.info(`Successfully set up Go version ${versionSpec}`); + } + else { + core.info('[warning]go-version input was not specified. The action will try to use pre-installed version.'); } const added = yield addBinToPath(); core.debug(`add bin ${added}`); - core.info(`Successfully set up Go version ${versionSpec}`); const goPath = yield io.which('go'); const goVersion = (child_process_1.default.execSync(`${goPath} version`) || '').toString(); if (cache && cache_utils_1.isCacheFeatureAvailable()) { const packageManager = 'default'; const cacheDependencyPath = core.getInput('cache-dependency-path'); - yield cache_restore_1.restoreCache(parseGoVersion(goVersion), packageManager, cacheDependencyPath); + try { + yield cache_restore_1.restoreCache(parseGoVersion(goVersion), packageManager, cacheDependencyPath); + } + catch (error) { + core.warning(`Restore cache failed: ${error.message}`); + } } // add problem matchers const matchersPath = path_1.default.join(__dirname, '../..', 'matchers.json'); diff --git a/src/main.ts b/src/main.ts index 06b7c3db7..b576f0b34 100644 --- a/src/main.ts +++ b/src/main.ts @@ -50,6 +50,8 @@ export async function run() { core.info('Setting GOROOT for Go version < 1.9'); core.exportVariable('GOROOT', installDir); } + + core.info(`Successfully set up Go version ${versionSpec}`); } else { core.info( '[warning]go-version input was not specified. The action will try to use pre-installed version.' @@ -58,7 +60,6 @@ export async function run() { const added = await addBinToPath(); core.debug(`add bin ${added}`); - core.info(`Successfully set up Go version ${versionSpec}`); const goPath = await io.which('go'); const goVersion = (cp.execSync(`${goPath} version`) || '').toString(); From f8a000bd795c77133f90efb6eaada559cd06c6d3 Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Tue, 14 Mar 2023 16:21:06 +0100 Subject: [PATCH 3/3] run format --- src/main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index b576f0b34..d3fb857df 100644 --- a/src/main.ts +++ b/src/main.ts @@ -50,7 +50,7 @@ export async function run() { core.info('Setting GOROOT for Go version < 1.9'); core.exportVariable('GOROOT', installDir); } - + core.info(`Successfully set up Go version ${versionSpec}`); } else { core.info(