mirror of
https://github.com/actions/setup-go.git
synced 2025-04-23 17:40:50 +00:00
Fix review points
README.md file was updated, removed async declaration in cache-utils file and changed the error message in cache-save file.
This commit is contained in:
parent
a4ab0b1477
commit
2d848c0e6a
5 changed files with 6 additions and 7 deletions
|
@ -97,7 +97,7 @@ steps:
|
||||||
```
|
```
|
||||||
## Caching dependency files and build outputs:
|
## Caching dependency files and build outputs:
|
||||||
|
|
||||||
The action has a built-in functionality for caching and restoring go modules and build outputs. It uses [actions/cache](https://github.com/actions/cache) under the hood but requires less configuration settings.The `cache` input is optional, and caching is turned off by default.
|
The action has a built-in functionality for caching and restoring go modules and build outputs. It uses [actions/cache](https://github.com/actions/cache) under the hood but requires less configuration settings. The `cache` input is optional, and caching is turned off by default.
|
||||||
|
|
||||||
The action defaults to search for the dependency file - go.sum in the repository root, and uses its hash as a part of the cache key. Use `cache-dependency-path` input for cases when multiple dependency files are used, or they are located in different subdirectories.
|
The action defaults to search for the dependency file - go.sum in the repository root, and uses its hash as a part of the cache key. Use `cache-dependency-path` input for cases when multiple dependency files are used, or they are located in different subdirectories.
|
||||||
|
|
||||||
|
|
4
dist/cache-save/index.js
vendored
4
dist/cache-save/index.js
vendored
|
@ -4036,7 +4036,7 @@ exports.getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, vo
|
||||||
return obtainedPackageManager;
|
return obtainedPackageManager;
|
||||||
});
|
});
|
||||||
exports.getCacheDirectoryPath = (packageManagerInfo) => __awaiter(void 0, void 0, void 0, function* () {
|
exports.getCacheDirectoryPath = (packageManagerInfo) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
let pathList = yield Promise.all(packageManagerInfo.cacheFolderCommandList.map((command) => __awaiter(void 0, void 0, void 0, function* () { return exports.getCommandOutput(command); })));
|
let pathList = yield Promise.all(packageManagerInfo.cacheFolderCommandList.map(command => exports.getCommandOutput(command)));
|
||||||
const emptyPaths = pathList.filter(item => !item);
|
const emptyPaths = pathList.filter(item => !item);
|
||||||
if (emptyPaths.length) {
|
if (emptyPaths.length) {
|
||||||
throw new Error(`Could not get cache folder paths.`);
|
throw new Error(`Could not get cache folder paths.`);
|
||||||
|
@ -49205,7 +49205,7 @@ const cachePackages = () => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
const cachePaths = yield cache_utils_1.getCacheDirectoryPath(packageManagerInfo);
|
const cachePaths = yield cache_utils_1.getCacheDirectoryPath(packageManagerInfo);
|
||||||
const nonExistingPaths = cachePaths.filter(cachePath => !fs_1.default.existsSync(cachePath));
|
const nonExistingPaths = cachePaths.filter(cachePath => !fs_1.default.existsSync(cachePath));
|
||||||
if (nonExistingPaths.length === cachePaths.length) {
|
if (nonExistingPaths.length === cachePaths.length) {
|
||||||
throw new Error(`No cache folders exist on disk`);
|
throw new Error(`There are no cache folders on the disk`);
|
||||||
}
|
}
|
||||||
if (nonExistingPaths.length) {
|
if (nonExistingPaths.length) {
|
||||||
logWarning(`Cache folder path is retrieved but doesn't exist on disk: ${nonExistingPaths.join(', ')}`);
|
logWarning(`Cache folder path is retrieved but doesn't exist on disk: ${nonExistingPaths.join(', ')}`);
|
||||||
|
|
2
dist/setup/index.js
vendored
2
dist/setup/index.js
vendored
|
@ -4307,7 +4307,7 @@ exports.getPackageManagerInfo = (packageManager) => __awaiter(void 0, void 0, vo
|
||||||
return obtainedPackageManager;
|
return obtainedPackageManager;
|
||||||
});
|
});
|
||||||
exports.getCacheDirectoryPath = (packageManagerInfo) => __awaiter(void 0, void 0, void 0, function* () {
|
exports.getCacheDirectoryPath = (packageManagerInfo) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
let pathList = yield Promise.all(packageManagerInfo.cacheFolderCommandList.map((command) => __awaiter(void 0, void 0, void 0, function* () { return exports.getCommandOutput(command); })));
|
let pathList = yield Promise.all(packageManagerInfo.cacheFolderCommandList.map(command => exports.getCommandOutput(command)));
|
||||||
const emptyPaths = pathList.filter(item => !item);
|
const emptyPaths = pathList.filter(item => !item);
|
||||||
if (emptyPaths.length) {
|
if (emptyPaths.length) {
|
||||||
throw new Error(`Could not get cache folder paths.`);
|
throw new Error(`Could not get cache folder paths.`);
|
||||||
|
|
|
@ -40,7 +40,7 @@ const cachePackages = async () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (nonExistingPaths.length === cachePaths.length) {
|
if (nonExistingPaths.length === cachePaths.length) {
|
||||||
throw new Error(`No cache folders exist on disk`);
|
throw new Error(`There are no cache folders on the disk`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nonExistingPaths.length) {
|
if (nonExistingPaths.length) {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import * as cache from '@actions/cache';
|
import * as cache from '@actions/cache';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
import path from 'path';
|
|
||||||
import {supportedPackageManagers, PackageManagerInfo} from './package-managers';
|
import {supportedPackageManagers, PackageManagerInfo} from './package-managers';
|
||||||
|
|
||||||
export const getCommandOutput = async (toolCommand: string) => {
|
export const getCommandOutput = async (toolCommand: string) => {
|
||||||
|
@ -36,7 +35,7 @@ export const getCacheDirectoryPath = async (
|
||||||
packageManagerInfo: PackageManagerInfo
|
packageManagerInfo: PackageManagerInfo
|
||||||
) => {
|
) => {
|
||||||
let pathList = await Promise.all(
|
let pathList = await Promise.all(
|
||||||
packageManagerInfo.cacheFolderCommandList.map(async command =>
|
packageManagerInfo.cacheFolderCommandList.map(command =>
|
||||||
getCommandOutput(command)
|
getCommandOutput(command)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Reference in a new issue