mirror of
https://github.com/actions/setup-go
synced 2024-12-22 22:32:42 +00:00
lint and build
Signed-off-by: Anton Troshin <anton@diagrid.io>
This commit is contained in:
parent
c8eefa5dde
commit
f8cf508b5f
1 changed files with 21 additions and 15 deletions
36
dist/setup/index.js
vendored
36
dist/setup/index.js
vendored
|
@ -88401,22 +88401,28 @@ function cacheWindowsDir(extPath, tool, version, arch) {
|
||||||
// iterate through actual cache directory paths and make links if necessary
|
// iterate through actual cache directory paths and make links if necessary
|
||||||
for (const cachePath of actualCacheDirectoryPaths) {
|
for (const cachePath of actualCacheDirectoryPaths) {
|
||||||
core.info(`Trying to link ${cachePath.defaultPath} to ${cachePath.actualPath}`);
|
core.info(`Trying to link ${cachePath.defaultPath} to ${cachePath.actualPath}`);
|
||||||
if (!fs_1.default.existsSync(cachePath.actualPath)) {
|
try {
|
||||||
core.info(`Creating directory ${cachePath.actualPath}`);
|
if (!fs_1.default.existsSync(cachePath.actualPath)) {
|
||||||
fs_1.default.mkdirSync(path.dirname(cachePath.actualPath), { recursive: true });
|
core.info(`Creating directory ${cachePath.actualPath}`);
|
||||||
|
fs_1.default.mkdirSync(path.dirname(cachePath.actualPath), { recursive: true });
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.info(`Directory ${cachePath.actualPath} already exists`);
|
||||||
|
}
|
||||||
|
// check if the default path is a symlink
|
||||||
|
const isSymlink = fs_1.default.lstatSync(cachePath.defaultPath).isSymbolicLink();
|
||||||
|
if (isSymlink) {
|
||||||
|
core.info(`Default path is symlink ${cachePath.defaultPath} => ${fs_1.default.readlinkSync(cachePath.defaultPath)}`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core.info(`Default path is not a symlink ${cachePath.defaultPath}`);
|
||||||
|
fs_1.default.symlinkSync(cachePath.actualPath, cachePath.defaultPath, 'junction');
|
||||||
|
core.info(`Created link ${cachePath.defaultPath} => ${cachePath.actualPath}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
catch (err) {
|
||||||
core.info(`Directory ${cachePath.actualPath} already exists`);
|
core.info(`Failed to link ${cachePath.defaultPath} to ${cachePath.actualPath}`);
|
||||||
}
|
core.info('Error: ' + err);
|
||||||
// make sure the link is pointing to the actual cache directory
|
|
||||||
const symlinkTarget = fs_1.default.readlinkSync(cachePath.defaultPath);
|
|
||||||
core.info(`Symlink target: ${symlinkTarget}`);
|
|
||||||
if (symlinkTarget !== "") {
|
|
||||||
core.info(`Found link ${cachePath.defaultPath} => ${symlinkTarget}`);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
fs_1.default.symlinkSync(cachePath.actualPath, cachePath.defaultPath, 'junction');
|
|
||||||
core.info(`Created link ${cachePath.defaultPath} => ${cachePath.actualPath}`);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// make outer code to continue using toolcache as if it were installed on c:
|
// make outer code to continue using toolcache as if it were installed on c:
|
||||||
|
|
Loading…
Reference in a new issue