From de201a09c02c0b8f41f4af0985ef74faa4b61273 Mon Sep 17 00:00:00 2001 From: Evgenii Korolevskii Date: Fri, 20 Jan 2023 01:21:36 +0100 Subject: [PATCH 1/5] log version-spec --- dist/setup/index.js | 1 + src/main.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/dist/setup/index.js b/dist/setup/index.js index cbc2a3c..92e96e0 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -63605,6 +63605,7 @@ function run() { if (cache && cache_utils_1.isCacheFeatureAvailable()) { const packageManager = 'default'; const cacheDependencyPath = core.getInput('cache-dependency-path'); + core.info(`Version spec is ${versionSpec}`); yield cache_restore_1.restoreCache(versionSpec, packageManager, cacheDependencyPath); } // add problem matchers diff --git a/src/main.ts b/src/main.ts index 5833f16..588f3cb 100644 --- a/src/main.ts +++ b/src/main.ts @@ -59,6 +59,7 @@ export async function run() { if (cache && isCacheFeatureAvailable()) { const packageManager = 'default'; const cacheDependencyPath = core.getInput('cache-dependency-path'); + core.info(`Version spec is ${versionSpec}`) await restoreCache(versionSpec, packageManager, cacheDependencyPath); } From 2e7414f2765af099fec02a98d384846c2bb18389 Mon Sep 17 00:00:00 2001 From: Evgenii Korolevskii Date: Fri, 20 Jan 2023 01:27:11 +0100 Subject: [PATCH 2/5] try get path --- dist/setup/index.js | 3 ++- src/main.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 92e96e0..525b57c 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -63605,7 +63605,8 @@ function run() { if (cache && cache_utils_1.isCacheFeatureAvailable()) { const packageManager = 'default'; const cacheDependencyPath = core.getInput('cache-dependency-path'); - core.info(`Version spec is ${versionSpec}`); + let goPath = yield io.which('go'); + core.info(`Version spec is ${versionSpec}, go path is ${goPath}`); yield cache_restore_1.restoreCache(versionSpec, packageManager, cacheDependencyPath); } // add problem matchers diff --git a/src/main.ts b/src/main.ts index 588f3cb..400c788 100644 --- a/src/main.ts +++ b/src/main.ts @@ -59,7 +59,8 @@ export async function run() { if (cache && isCacheFeatureAvailable()) { const packageManager = 'default'; const cacheDependencyPath = core.getInput('cache-dependency-path'); - core.info(`Version spec is ${versionSpec}`) + let goPath = await io.which('go'); + core.info(`Version spec is ${versionSpec}, go path is ${goPath}`) await restoreCache(versionSpec, packageManager, cacheDependencyPath); } From 89d7939d3809809ca1f782af8b9e843111b8e71b Mon Sep 17 00:00:00 2001 From: Evgenii Korolevskii Date: Fri, 20 Jan 2023 01:28:58 +0100 Subject: [PATCH 3/5] 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)); From 65f50caf4238e9632388f77b1f799742d019da57 Mon Sep 17 00:00:00 2001 From: Evgenii Korolevskii Date: Fri, 20 Jan 2023 01:30:38 +0100 Subject: [PATCH 4/5] use actual version in key --- dist/setup/index.js | 3 +-- src/main.ts | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 63dba41..0481318 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -63607,8 +63607,7 @@ function run() { if (cache && cache_utils_1.isCacheFeatureAvailable()) { const packageManager = 'default'; const cacheDependencyPath = core.getInput('cache-dependency-path'); - core.info(`Version spec is ${versionSpec}, go version is ${goVersion}`); - yield cache_restore_1.restoreCache(goVersion, packageManager, cacheDependencyPath); + yield cache_restore_1.restoreCache(parseGoVersion(goVersion), packageManager, cacheDependencyPath); } // add problem matchers const matchersPath = path_1.default.join(__dirname, '../..', 'matchers.json'); diff --git a/src/main.ts b/src/main.ts index adc31e4..f783dd4 100644 --- a/src/main.ts +++ b/src/main.ts @@ -62,8 +62,7 @@ export async function run() { if (cache && isCacheFeatureAvailable()) { const packageManager = 'default'; const cacheDependencyPath = core.getInput('cache-dependency-path'); - core.info(`Version spec is ${versionSpec}, go version is ${goVersion}`) - await restoreCache(goVersion, packageManager, cacheDependencyPath); + await restoreCache(parseGoVersion(goVersion), packageManager, cacheDependencyPath); } // add problem matchers From b27afcd9c2d9a462f3e6371f30ab82b0844ffd0c Mon Sep 17 00:00:00 2001 From: Evgenii Korolevskii Date: Fri, 20 Jan 2023 10:28:57 +0100 Subject: [PATCH 5/5] format --- src/main.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index f783dd4..6cdb2e6 100644 --- a/src/main.ts +++ b/src/main.ts @@ -62,7 +62,11 @@ export async function run() { if (cache && isCacheFeatureAvailable()) { const packageManager = 'default'; const cacheDependencyPath = core.getInput('cache-dependency-path'); - await restoreCache(parseGoVersion(goVersion), packageManager, cacheDependencyPath); + await restoreCache( + parseGoVersion(goVersion), + packageManager, + cacheDependencyPath + ); } // add problem matchers