Was the command line option --out-format
removed at golangci-lint v2?
#5612
Answered
by
ldez
suzuki-shunsuke
asked this question in
Q&A
-
Hello. Thank you for your great project! I noticed v2.0.1$ golangci-lint --version
golangci-lint has version 2.0.1 built with go1.24.1 from e8927ce2 on 2025-03-24T20:34:31Z
$ golangci-lint run --help | grep out-format
$ golangci-lint run --out-format
Error: unknown flag: --out-format
Failed executing command with error: unknown flag: --out-format v2.0.0$ golangci-lint --version
golangci-lint has version 2.0.0 built with go1.24.1 from f1f8343d on 2025-03-24T12:12:51Z
$ golangci-lint run --help | grep out-format
$ golangci-lint run --out-format
Error: unknown flag: --out-format
Failed executing command with error: unknown flag: --out-format v1.64.8$ golangci-lint --version
golangci-lint has version 1.64.8 built with go1.24.1 from 8b37f141 on 2025-03-17T20:41:53Z
$ golangci-lint run --help | grep out-format
--out-format string Formats of output: I read the migration guide, but I can't find this breaking change. https://golangci-lint.run/product/migration-guide/ And I can't find any alternative option. help$ golangci-lint run --help
Run the linters
Usage:
golangci-lint run [flags]
Flags:
-c, --config PATH Read config from file path PATH
--no-config Don't read config file
--default string Default set of linters to enable (default "standard")
-D, --disable strings Disable specific linter
-E, --enable strings Enable specific linter
--enable-only strings Override linters configuration section to only run the specific linter(s)
--fast-only Filter enabled linters to run only fast linters
-j, --concurrency int Number of CPUs to use (Default: Automatically set to match Linux container CPU quota and fall back to the number of logical CPUs in the machine)
--modules-download-mode string Modules download mode. If not empty, passed as -mod=<mode> to go tools
--issues-exit-code int Exit code when issues were found (default 1)
--build-tags strings Build tags
--timeout duration Timeout for total work. Disabled by default
--tests Analyze tests (*_test.go) (default true)
--allow-parallel-runners Allow multiple parallel golangci-lint instances running.
If false (default) - golangci-lint acquires file lock on start.
--allow-serial-runners Allow multiple golangci-lint instances running, but serialize them around a lock.
If false (default) - golangci-lint exits with an error if it fails to acquire file lock on start.
--path-prefix string Path prefix to add to output
--show-stats Show statistics per linter (default true)
--output.text.path stdout Output path can be either stdout, `stderr` or path to the file to write to.
--output.text.print-linter-name Print linter name in the end of issue text. (default true)
--output.text.print-issued-lines Print lines of code with issue. (default true)
--output.text.colors Use colors. (default true)
--output.json.path stdout Output path can be either stdout, `stderr` or path to the file to write to.
--output.tab.path stdout Output path can be either stdout, `stderr` or path to the file to write to.
--output.tab.print-linter-name Print linter name in the end of issue text. (default true)
--output.tab.colors Use colors. (default true)
--output.html.path stdout Output path can be either stdout, `stderr` or path to the file to write to.
--output.checkstyle.path stdout Output path can be either stdout, `stderr` or path to the file to write to.
--output.code-climate.path stdout Output path can be either stdout, `stderr` or path to the file to write to.
--output.junit-xml.path stdout Output path can be either stdout, `stderr` or path to the file to write to.
--output.junit-xml.extended Support extra JUnit XML fields.
--output.teamcity.path stdout Output path can be either stdout, `stderr` or path to the file to write to.
--output.sarif.path stdout Output path can be either stdout, `stderr` or path to the file to write to.
--max-issues-per-linter int Maximum issues count per one linter. Set to 0 to disable (default 50)
--max-same-issues int Maximum count of issues with the same text. Set to 0 to disable (default 3)
--uniq-by-line Make issues output unique by line (default true)
-n, --new Show only new issues: if there are unstaged changes or untracked files, only those changes are analyzed, else only changes in HEAD~ are analyzed.
It's a super-useful option for integration of golangci-lint into existing large codebase.
It's not practical to fix all existing issues at the moment of integration: much better to not allow issues in new code.
For CI setups, prefer --new-from-rev=HEAD~, as --new can skip linting the current patch if any scripts generate unstaged files before golangci-lint runs.
--new-from-rev REV Show only new issues created after git revision REV
--new-from-patch PATH Show only new issues created in git patch with file path PATH
--new-from-merge-base string Show only new issues created after the best common ancestor (merge-base against HEAD)
--whole-files Show issues in any part of update files (requires new-from-rev or new-from-patch)
--fix Fix found issues (if it's supported by the linter)
--cpu-profile-path string Path to CPU profile output file
--mem-profile-path string Path to memory profile output file
--print-resources-usage Print avg and max memory usage of golangci-lint and total time
--trace-path string Path to trace output file
Global Flags:
--color string Use color when printing; can be 'always', 'auto', or 'never' (default "auto")
-h, --help Help for a command
-v, --verbose Verbose output How should we migrate? |
Beta Was this translation helpful? Give feedback.
Answered by
ldez
Mar 24, 2025
Replies: 1 comment 9 replies
-
Hello, I recommend reading the migration guide: https://golangci-lint.run/product/migration-guide/#output |
Beta Was this translation helpful? Give feedback.
9 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
--out-format
has been migrated to the following flags: