Skip to content

fix: select golangci-lint JSON output flag by major version - #12

Closed
DatScreamer wants to merge 1 commit into
QuentinCody:mainfrom
DatScreamer:fix/golangci-lint-v2-json-output
Closed

DatScreamer wants to merge 1 commit into
QuentinCody:mainfrom
DatScreamer:fix/golangci-lint-v2-json-output

Conversation

@DatScreamer

Copy link
Copy Markdown
Contributor

Fixes #11

Summary

runGolangciLint always passed --out-format=json. golangci-lint v2 removed that flag, so the run exits before analysis. This probes golangci-lint version and selects the flag from the major version:

  • v1, and unrecognized version text: --out-format=json
  • v2 and newer: --output.json.path=stdout

A full command override in tool commands is still passed through unchanged.

Tests

go.integration.test.ts covers the v1 and v2 argv, and golangciJsonFormatArg covers 1.x, 2.x, and empty version text.

golangci-lint v2 removed --out-format. Probe `golangci-lint version` and
pass --output.json.path=stdout on v2+, keeping --out-format=json for v1
and for unrecognized version text.
@DatScreamer
DatScreamer force-pushed the fix/golangci-lint-v2-json-output branch from 013e5ba to af9672c Compare October 9, 2026 09:41
@DatScreamer

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (31b5259f). The previous head was branched from an older fork history, so the pull request listed those commits too. This head is one commit, af9672c8, and touches only the golangci-lint runner and its test.

@QuentinCody

Copy link
Copy Markdown
Owner

Included in #14 (merged as fdfd1cf). Thank you.

@QuentinCody QuentinCody closed this Oct 9, 2026
@DatScreamer
DatScreamer deleted the fix/golangci-lint-v2-json-output branch October 9, 2026 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

golangci-lint v2 is reported clean: --out-format was removed and exit 3 is ignored

2 participants