@@ -2233,11 +2233,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
22332233 step((generator = generator.apply(thisArg, _arguments || [])).next());
22342234 });
22352235};
2236+ var __importDefault = (this && this.__importDefault) || function (mod) {
2237+ return (mod && mod.__esModule) ? mod : { "default": mod };
2238+ };
22362239Object.defineProperty(exports, "__esModule", { value: true });
22372240exports.findLintVersion = exports.stringifyVersion = void 0;
22382241const core = __importStar(__webpack_require__(470));
22392242const httpm = __importStar(__webpack_require__(539));
22402243const fs = __importStar(__webpack_require__(747));
2244+ const path_1 = __importDefault(__webpack_require__(622));
22412245const versionRe = /^v(\d+)\.(\d+)(?:\.(\d+))?$/;
22422246const modVersionRe = /github.com\/golangci\/golangci-lint\s(v.+)/;
22432247const parseVersion = (s) => {
@@ -2282,12 +2286,17 @@ const isLessVersion = (a, b) => {
22822286};
22832287const getRequestedLintVersion = () => {
22842288 let requestedLintVersion = core.getInput(`version`);
2285- if (requestedLintVersion == "") {
2286- const content = fs.readFileSync("go.mod", "utf-8");
2289+ const workingDirectory = core.getInput(`working-directory`);
2290+ let goMod = "go.mod";
2291+ if (workingDirectory) {
2292+ goMod = path_1.default.join(workingDirectory, goMod);
2293+ }
2294+ if (requestedLintVersion == "" && fs.existsSync(goMod)) {
2295+ const content = fs.readFileSync(goMod, "utf-8");
22872296 const match = content.match(modVersionRe);
22882297 if (match) {
22892298 requestedLintVersion = match[1];
2290- core.info(`Found golangci-lint version '${requestedLintVersion}' in go.mod `);
2299+ core.info(`Found golangci-lint version '${requestedLintVersion}' in '${goMod}' file `);
22912300 }
22922301 }
22932302 const parsedRequestedLintVersion = parseVersion(requestedLintVersion);
0 commit comments