Skip to content

Commit 30ceb27

Browse files
fix: migrate to golangci-lint v2
1 parent c6764e1 commit 30ceb27

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/main.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,19 @@ async function run(): Promise<void> {
5858
}
5959

6060
const output = await core.group("Running golangci-lint ...", async (): Promise<exec.ExecOutput> => {
61+
const versionNumber = golangciLintVersion.match(/^v?(\d+)/);
62+
if (!versionNumber) {
63+
throw new Error(`Invalid golangci-lint version: ${golangciLintVersion}`);
64+
}
65+
const isV1 = parseInt(versionNumber[1], 10) === 1;
66+
67+
const options = isV1
68+
? ["run", "--out-format", "line-number", ...flags.parse(golangciLintFlags)]
69+
: ["run", "--output.text.path", "stdout", ...flags.parse(golangciLintFlags)];
70+
6171
return await exec.getExecOutput(
6272
golangci,
63-
["run", "--out-format", "line-number", ...flags.parse(golangciLintFlags)],
73+
options,
6474
{
6575
cwd,
6676
ignoreReturnCode: true,

0 commit comments

Comments
 (0)