@@ -41407,18 +41407,51 @@ Object.defineProperty(exports, "__esModule", { value: true });
4140741407exports.installGo = exports.installLint = void 0;
4140841408const core = __importStar(__webpack_require__(470));
4140941409const tc = __importStar(__webpack_require__(533));
41410+ const os_1 = __importDefault(__webpack_require__(87));
4141041411const path_1 = __importDefault(__webpack_require__(622));
4141141412const 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+ };
4141241436// The installLint returns path to installed binary of golangci-lint.
4141341437function installLint(versionConfig) {
4141441438 return __awaiter(this, void 0, void 0, function* () {
4141541439 core.info(`Installing golangci-lint ${versionConfig.TargetVersion}...`);
4141641440 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, ``);
4142241455 const lintPath = path_1.default.join(extractedDir, dirName, `golangci-lint`);
4142341456 core.info(`Installed golangci-lint into ${lintPath} in ${Date.now() - startedAt}ms`);
4142441457 return lintPath;
@@ -42651,12 +42684,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
4265142684 step((generator = generator.apply(thisArg, _arguments || [])).next());
4265242685 });
4265342686};
42687+ var __importDefault = (this && this.__importDefault) || function (mod) {
42688+ return (mod && mod.__esModule) ? mod : { "default": mod };
42689+ };
4265442690Object.defineProperty(exports, "__esModule", { value: true });
4265542691exports.saveCache = exports.restoreCache = void 0;
4265642692const cache = __importStar(__webpack_require__(638));
4265742693const core = __importStar(__webpack_require__(470));
4265842694const crypto = __importStar(__webpack_require__(417));
4265942695const fs = __importStar(__webpack_require__(747));
42696+ const path_1 = __importDefault(__webpack_require__(622));
4266042697const constants_1 = __webpack_require__(694);
4266142698const utils = __importStar(__webpack_require__(443));
4266242699function checksumFile(hashName, path) {
@@ -42669,10 +42706,12 @@ function checksumFile(hashName, path) {
4266942706 });
4267042707}
4267142708const 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+ };
4267342712const getCacheDirs = () => {
4267442713 // 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`) ];
4267642715};
4267742716const getIntervalKey = (invalidationIntervalDays) => {
4267842717 const now = new Date();
0 commit comments