mirror of
https://github.com/actions/setup-go.git
synced 2026-04-06 04:39:24 +00:00
handle distinct cache
This commit is contained in:
parent
3efc8fd0e3
commit
fa4cd7679b
3 changed files with 23 additions and 5 deletions
10
dist/setup/index.js
vendored
10
dist/setup/index.js
vendored
|
|
@ -77034,6 +77034,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.GOTOOLCHAIN_LOCAL_VAL = exports.GOTOOLCHAIN_ENV_VAR = void 0;
|
||||
exports.getGo = getGo;
|
||||
exports.customToolCacheName = customToolCacheName;
|
||||
exports.extractGoArchive = extractGoArchive;
|
||||
exports.getManifest = getManifest;
|
||||
exports.getInfoFromManifest = getInfoFromManifest;
|
||||
|
|
@ -77049,6 +77050,7 @@ const path = __importStar(__nccwpck_require__(16928));
|
|||
const semver = __importStar(__nccwpck_require__(62088));
|
||||
const httpm = __importStar(__nccwpck_require__(54844));
|
||||
const sys = __importStar(__nccwpck_require__(57666));
|
||||
const crypto_1 = __importDefault(__nccwpck_require__(76982));
|
||||
const child_process_1 = __importDefault(__nccwpck_require__(35317));
|
||||
const fs_1 = __importDefault(__nccwpck_require__(79896));
|
||||
const os_1 = __importDefault(__nccwpck_require__(70857));
|
||||
|
|
@ -77101,7 +77103,9 @@ function getGo(versionSpec_1, checkLatest_1, auth_1) {
|
|||
}
|
||||
// Use a distinct tool cache name for custom downloads to avoid
|
||||
// colliding with the runner's pre-installed Go
|
||||
const toolCacheName = customBaseUrl ? 'go-custom' : 'go';
|
||||
const toolCacheName = customBaseUrl
|
||||
? customToolCacheName(customBaseUrl)
|
||||
: 'go';
|
||||
// check cache
|
||||
const toolPath = tc.find(toolCacheName, versionSpec, arch);
|
||||
// If not found in cache, download
|
||||
|
|
@ -77237,6 +77241,10 @@ function addExecutablesToToolCache(extPath_1, info_1, arch_1) {
|
|||
(yield tc.cacheDir(extPath, toolName, version, arch)));
|
||||
});
|
||||
}
|
||||
function customToolCacheName(baseUrl) {
|
||||
const hash = crypto_1.default.createHash('sha256').update(baseUrl).digest('hex');
|
||||
return `go-${hash.substring(0, 8)}`;
|
||||
}
|
||||
function installGoVersion(info_1, auth_1, arch_1) {
|
||||
return __awaiter(this, arguments, void 0, function* (info, auth, arch, toolName = 'go') {
|
||||
core.info(`Acquiring ${info.resolvedVersion} from ${info.downloadUrl}`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue