@@ -41407,18 +41407,51 @@ Object.defineProperty(exports, "__esModule", { value: true });
41407
41407
exports.installGo = exports.installLint = void 0;
41408
41408
const core = __importStar(__webpack_require__(470));
41409
41409
const tc = __importStar(__webpack_require__(533));
41410
+ const os_1 = __importDefault(__webpack_require__(87));
41410
41411
const path_1 = __importDefault(__webpack_require__(622));
41411
41412
const main_1 = __webpack_require__(514);
41413
+ const downloadURL = "https://github.com/golangci/golangci-lint/releases/download";
41414
+ const getAssetURL = (versionConfig) => {
41415
+ let ext = "tar.gz";
41416
+ let platform = os_1.default.platform().toString();
41417
+ switch (platform) {
41418
+ case "win32":
41419
+ platform = "windows";
41420
+ ext = "zip";
41421
+ break;
41422
+ }
41423
+ let arch = os_1.default.arch();
41424
+ switch (arch) {
41425
+ case "x64":
41426
+ arch = "amd64";
41427
+ break;
41428
+ case "x32":
41429
+ case "ia32":
41430
+ arch = "386";
41431
+ break;
41432
+ }
41433
+ const noPrefix = versionConfig.TargetVersion.slice(1);
41434
+ return `${downloadURL}/${versionConfig.TargetVersion}/golangci-lint-${noPrefix}-${platform}-${arch}.${ext}`;
41435
+ };
41412
41436
// The installLint returns path to installed binary of golangci-lint.
41413
41437
function installLint(versionConfig) {
41414
41438
return __awaiter(this, void 0, void 0, function* () {
41415
41439
core.info(`Installing golangci-lint ${versionConfig.TargetVersion}...`);
41416
41440
const startedAt = Date.now();
41417
- core.info(`Downloading ${versionConfig.AssetURL} ...`);
41418
- const tarGzPath = yield tc.downloadTool(versionConfig.AssetURL);
41419
- const extractedDir = yield tc.extractTar(tarGzPath, process.env.HOME);
41420
- const urlParts = versionConfig.AssetURL.split(`/`);
41421
- const dirName = urlParts[urlParts.length - 1].replace(/\.tar\.gz$/, ``);
41441
+ const assetURL = getAssetURL(versionConfig);
41442
+ core.info(`Downloading ${assetURL} ...`);
41443
+ const archivePath = yield tc.downloadTool(assetURL);
41444
+ let extractedDir = "";
41445
+ let repl = /\.tar\.gz$/;
41446
+ if (assetURL.endsWith("zip")) {
41447
+ extractedDir = yield tc.extractZip(archivePath, process.env.HOME);
41448
+ repl = /\.zip$/;
41449
+ }
41450
+ else {
41451
+ extractedDir = yield tc.extractTar(archivePath, process.env.HOME);
41452
+ }
41453
+ const urlParts = assetURL.split(`/`);
41454
+ const dirName = urlParts[urlParts.length - 1].replace(repl, ``);
41422
41455
const lintPath = path_1.default.join(extractedDir, dirName, `golangci-lint`);
41423
41456
core.info(`Installed golangci-lint into ${lintPath} in ${Date.now() - startedAt}ms`);
41424
41457
return lintPath;
@@ -42651,12 +42684,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
42651
42684
step((generator = generator.apply(thisArg, _arguments || [])).next());
42652
42685
});
42653
42686
};
42687
+ var __importDefault = (this && this.__importDefault) || function (mod) {
42688
+ return (mod && mod.__esModule) ? mod : { "default": mod };
42689
+ };
42654
42690
Object.defineProperty(exports, "__esModule", { value: true });
42655
42691
exports.saveCache = exports.restoreCache = void 0;
42656
42692
const cache = __importStar(__webpack_require__(638));
42657
42693
const core = __importStar(__webpack_require__(470));
42658
42694
const crypto = __importStar(__webpack_require__(417));
42659
42695
const fs = __importStar(__webpack_require__(747));
42696
+ const path_1 = __importDefault(__webpack_require__(622));
42660
42697
const constants_1 = __webpack_require__(694);
42661
42698
const utils = __importStar(__webpack_require__(443));
42662
42699
function checksumFile(hashName, path) {
@@ -42669,10 +42706,12 @@ function checksumFile(hashName, path) {
42669
42706
});
42670
42707
}
42671
42708
const pathExists = (path) => __awaiter(void 0, void 0, void 0, function* () { return !!(yield fs.promises.stat(path).catch(() => false)); });
42672
- const getLintCacheDir = () => `${process.env.HOME}/.cache/golangci-lint`;
42709
+ const getLintCacheDir = () => {
42710
+ return path_1.default.resolve(`${process.env.HOME}/.cache/golangci-lint`);
42711
+ };
42673
42712
const getCacheDirs = () => {
42674
42713
// Not existing dirs are ok here: it works.
42675
- return [getLintCacheDir(), `${process.env.HOME}/.cache/go-build`, `${process.env.HOME}/go/pkg`];
42714
+ return [getLintCacheDir(), path_1.default.resolve( `${process.env.HOME}/.cache/go-build`), path_1.default.resolve( `${process.env.HOME}/go/pkg`) ];
42676
42715
};
42677
42716
const getIntervalKey = (invalidationIntervalDays) => {
42678
42717
const now = new Date();
0 commit comments