Skip to content

Commit

Permalink
Merge pull request #323 from e-korolevskii/use-actual-version-in-cache
Browse files Browse the repository at this point in the history
Use actual version in cache
  • Loading branch information
marko-zivic-93 committed Jan 31, 2023
2 parents 8075593 + b8eec33 commit a3d889c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
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

1 comment on commit a3d889c

@Mago16
Copy link

@Mago16 Mago16 commented on a3d889c Feb 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.