@@ -2233,11 +2233,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
2233
2233
step((generator = generator.apply(thisArg, _arguments || [])).next());
2234
2234
});
2235
2235
};
2236
+ var __importDefault = (this && this.__importDefault) || function (mod) {
2237
+ return (mod && mod.__esModule) ? mod : { "default": mod };
2238
+ };
2236
2239
Object.defineProperty(exports, "__esModule", { value: true });
2237
2240
exports.findLintVersion = exports.stringifyVersion = void 0;
2238
2241
const core = __importStar(__webpack_require__(470));
2239
2242
const httpm = __importStar(__webpack_require__(539));
2240
2243
const fs = __importStar(__webpack_require__(747));
2244
+ const path_1 = __importDefault(__webpack_require__(622));
2241
2245
const versionRe = /^v(\d+)\.(\d+)(?:\.(\d+))?$/;
2242
2246
const modVersionRe = /github.com\/golangci\/golangci-lint\s(v.+)/;
2243
2247
const parseVersion = (s) => {
@@ -2282,12 +2286,17 @@ const isLessVersion = (a, b) => {
2282
2286
};
2283
2287
const getRequestedLintVersion = () => {
2284
2288
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");
2287
2296
const match = content.match(modVersionRe);
2288
2297
if (match) {
2289
2298
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 `);
2291
2300
}
2292
2301
}
2293
2302
const parsedRequestedLintVersion = parseVersion(requestedLintVersion);
0 commit comments