Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use actual version in cache #323

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions dist/setup/index.js
Expand Up @@ -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');
Expand Down
11 changes: 8 additions & 3 deletions src/main.ts
Expand Up @@ -56,19 +56,24 @@ 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
const matchersPath = path.join(__dirname, '../..', 'matchers.json');
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));
Expand Down