-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Suppress output to stdout in case of 0 issues found #5734
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors. |
Hello, The stats can be disabled with the following option: output:
show-stats: false https://golangci-lint.run/usage/configuration/#output-configuration or
|
Can I ask that we reopen this? What I think the original poster is asking for (or at least, I am 😁 ) is that it shows no stats only if there are no errors. I think there are lots of programs out there that built around the output of $ golangci-lint run ./...
....
...
1 issues:
* staticcheck: 1
$ echo $?
1
$ But: $ golangci-lint run ./...
$ echo $?
0
$ Thanks |
It used to be a common Unix practice to output nothing if you modified/found nothing. |
I just checked: $ docker run --rm -it golang:1.24.2
# curl -sOL https://github.com/golangci/golangci-lint/releases/download/v1.64.8/golangci-lint-1.64.8-linux-amd64.deb
# apt install ./golangci-lint-1.64.8-linux-amd64.deb
# printf 'package main\nimport "fmt"\nfunc main(){fmt.Println("Test")}' >src/main.go
# 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 src/main.go
# echo $?
0 $ docker run --rm -it golang:1.24.2
# curl -sOL https://github.com/golangci/golangci-lint/releases/download/v2.1.2/golangci-lint-2.1.2-linux-amd64.deb
# apt install ./golangci-lint-2.1.2-linux-amd64.deb
# printf 'package main\nimport "fmt"\nfunc main(){fmt.Println("Test")}' >src/main.go
# golangci-lint --version
golangci-lint has version 2.1.2 built with go1.24.2 from 00a561d9 on 2025-04-15T13:26:47Z
# golangci-lint run src/main.go
0 issues.
# echo $?
0 I would say this is either a regression or an undocumented change in behavior. |
The "0 issues." is the expected behavior; it's not a regression because this is the same behavior as v1 with |
You are comparing two major versions, 1.0 and 2.0, so there are a bunch of breaking changes between them and this being one of them. It's mentioned in the migration guide
› docker run --rm -it golangci/golangci-lint:v1.64.8 /bin/bash
root@7f255dd6f820:/go# printf 'package main\nimport "fmt"\nfunc main(){fmt.Println("Test")}' >src/main.go && cd src
root@7f255dd6f820:/go/src# go mod init x
go: creating new go.mod: module x
root@7f255dd6f820:/go/src# golangci-lint run --show-stats
0 issues. EDIT Oops 🐢, @ldez beat me to it 🏎 |
I was not as focused on whether or not it is a regression; heaven knows I am responsible for enough software with behavioural changes between major versions that people complained about. 😁 I was focused on, it is good to have the ability to show stats when there are errors, but to have empty output when there are none. Right now, it is either: show stats whether or not there are errors; or do not show stats whether or not there are errors. Does that make sense? |
The "0 issues" is the expected behavior. For now, I don't think adding another option only to hide the "0 issues" is worth it. |
I get that. I am suggesting that another behaviour may be more user-friendly in many cases (and hopefully get other people off your back). Would |
I think I answered in the previous comment:
|
Welcome
How did you install golangci-lint?
Brew
Your feature request related to a problem? Please describe
I am not sure if this is a bug, regression, or feature request.
I would like the option to suppress output to stdout in case of no issues found.
Describe the solution you'd like
Maybe via
-q
/--quiet
or-s
/--silent
.Describe alternatives you've considered
1>/dev/null
and explicit check of$?
Additional context
No response
Supporter
The text was updated successfully, but these errors were encountered: