From 89d7939d3809809ca1f782af8b9e843111b8e71b Mon Sep 17 00:00:00 2001 From: Evgenii Korolevskii Date: Fri, 20 Jan 2023 01:28:58 +0100 Subject: [PATCH] use real version instead of spec --- dist/setup/index.js | 9 ++++----- src/main.ts | 10 +++++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 525b57c..63dba41 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -63602,19 +63602,18 @@ function run() { core.debug(`add bin ${added}`); core.info(`Successfully set up Go version ${versionSpec}`); } + let goPath = yield io.which('go'); + let 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'); - let goPath = yield io.which('go'); - core.info(`Version spec is ${versionSpec}, go path is ${goPath}`); - yield cache_restore_1.restoreCache(versionSpec, packageManager, cacheDependencyPath); + core.info(`Version spec is ${versionSpec}, go version is ${goVersion}`); + yield cache_restore_1.restoreCache(goVersion, packageManager, cacheDependencyPath); } // add problem matchers const matchersPath = path_1.default.join(__dirname, '../..', 'matchers.json'); core.info(`##[add-matcher]${matchersPath}`); // output the version actually being used - let goPath = yield io.which('go'); - let goVersion = (child_process_1.default.execSync(`${goPath} version`) || '').toString(); core.info(goVersion); core.setOutput('go-version', parseGoVersion(goVersion)); core.startGroup('go env'); diff --git a/src/main.ts b/src/main.ts index 400c788..adc31e4 100644 --- a/src/main.ts +++ b/src/main.ts @@ -56,12 +56,14 @@ export async function run() { core.info(`Successfully set up Go version ${versionSpec}`); } + let goPath = await io.which('go'); + let goVersion = (cp.execSync(`${goPath} version`) || '').toString(); + if (cache && isCacheFeatureAvailable()) { const packageManager = 'default'; const cacheDependencyPath = core.getInput('cache-dependency-path'); - let goPath = await io.which('go'); - core.info(`Version spec is ${versionSpec}, go path is ${goPath}`) - await restoreCache(versionSpec, packageManager, cacheDependencyPath); + core.info(`Version spec is ${versionSpec}, go version is ${goVersion}`) + await restoreCache(goVersion, packageManager, cacheDependencyPath); } // add problem matchers @@ -69,8 +71,6 @@ export async function run() { core.info(`##[add-matcher]${matchersPath}`); // output the version actually being used - let goPath = await io.which('go'); - let goVersion = (cp.execSync(`${goPath} version`) || '').toString(); core.info(goVersion); core.setOutput('go-version', parseGoVersion(goVersion));