mirror of
https://github.com/actions/setup-go.git
synced 2024-11-15 11:54:34 +08:00
Merge pull request #323 from e-korolevskii/use-actual-version-in-cache
Use actual version in cache
This commit is contained in:
commit
a3d889c34c
6
dist/setup/index.js
vendored
6
dist/setup/index.js
vendored
@ -63602,17 +63602,17 @@ 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');
|
||||
yield cache_restore_1.restoreCache(versionSpec, packageManager, cacheDependencyPath);
|
||||
yield cache_restore_1.restoreCache(parseGoVersion(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
|
||||
const goPath = yield io.which('go');
|
||||
const goVersion = (child_process_1.default.execSync(`${goPath} version`) || '').toString();
|
||||
core.info(goVersion);
|
||||
core.setOutput('go-version', parseGoVersion(goVersion));
|
||||
core.startGroup('go env');
|
||||
|
11
src/main.ts
11
src/main.ts
@ -56,10 +56,17 @@ 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');
|
||||
await restoreCache(versionSpec, packageManager, cacheDependencyPath);
|
||||
await restoreCache(
|
||||
parseGoVersion(goVersion),
|
||||
packageManager,
|
||||
cacheDependencyPath
|
||||
);
|
||||
}
|
||||
|
||||
// add problem matchers
|
||||
@ -67,8 +74,6 @@ export async function run() {
|
||||
core.info(`##[add-matcher]${matchersPath}`);
|
||||
|
||||
// output the version actually being used
|
||||
const goPath = await io.which('go');
|
||||
const goVersion = (cp.execSync(`${goPath} version`) || '').toString();
|
||||
core.info(goVersion);
|
||||
|
||||
core.setOutput('go-version', parseGoVersion(goVersion));
|
||||
|
Loading…
Reference in New Issue
Block a user