Skip to content

Commit a3d889c

Browse files
Merge pull request #323 from e-korolevskii/use-actual-version-in-cache
Use actual version in cache
2 parents 8075593 + b8eec33 commit a3d889c

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

dist/setup/index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -63602,17 +63602,17 @@ function run() {
6360263602
core.debug(`add bin ${added}`);
6360363603
core.info(`Successfully set up Go version ${versionSpec}`);
6360463604
}
63605+
let goPath = yield io.which('go');
63606+
let goVersion = (child_process_1.default.execSync(`${goPath} version`) || '').toString();
6360563607
if (cache && cache_utils_1.isCacheFeatureAvailable()) {
6360663608
const packageManager = 'default';
6360763609
const cacheDependencyPath = core.getInput('cache-dependency-path');
63608-
yield cache_restore_1.restoreCache(versionSpec, packageManager, cacheDependencyPath);
63610+
yield cache_restore_1.restoreCache(parseGoVersion(goVersion), packageManager, cacheDependencyPath);
6360963611
}
6361063612
// add problem matchers
6361163613
const matchersPath = path_1.default.join(__dirname, '../..', 'matchers.json');
6361263614
core.info(`##[add-matcher]${matchersPath}`);
6361363615
// output the version actually being used
63614-
const goPath = yield io.which('go');
63615-
const goVersion = (child_process_1.default.execSync(`${goPath} version`) || '').toString();
6361663616
core.info(goVersion);
6361763617
core.setOutput('go-version', parseGoVersion(goVersion));
6361863618
core.startGroup('go env');

src/main.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,24 @@ export async function run() {
5656
core.info(`Successfully set up Go version ${versionSpec}`);
5757
}
5858

59+
let goPath = await io.which('go');
60+
let goVersion = (cp.execSync(`${goPath} version`) || '').toString();
61+
5962
if (cache && isCacheFeatureAvailable()) {
6063
const packageManager = 'default';
6164
const cacheDependencyPath = core.getInput('cache-dependency-path');
62-
await restoreCache(versionSpec, packageManager, cacheDependencyPath);
65+
await restoreCache(
66+
parseGoVersion(goVersion),
67+
packageManager,
68+
cacheDependencyPath
69+
);
6370
}
6471

6572
// add problem matchers
6673
const matchersPath = path.join(__dirname, '../..', 'matchers.json');
6774
core.info(`##[add-matcher]${matchersPath}`);
6875

6976
// output the version actually being used
70-
const goPath = await io.which('go');
71-
const goVersion = (cp.execSync(`${goPath} version`) || '').toString();
7277
core.info(goVersion);
7378

7479
core.setOutput('go-version', parseGoVersion(goVersion));

0 commit comments

Comments
 (0)