How to make goclangci-lint show all errors at once?

2.6k Views Asked by At

I'm linting my Go project with the following command using the golangci-lint tool like this:

> golangci-lint run

There are numerous files in this project. So there are dozens (maybe over 100?) linter errors. But something annoying keeps happening. It shows me about a dozen or so linter errors, Then I go fix them, then it shows me another dozen errors, then I go fix them, etc, etc, etc. This loop repeats for many times.

But as I'm going through this loop, I have no clue about the total number of linter errors remaining and so I can't figure out how close I am to being done. I feel like Sisyphus!

How can I make golangci-lint list me all the linter errors with the total count?

Compilers and linter for other languages do this all the time. It's so elementary. I can't believe they made this terrible design decision.

1

There are 1 best solutions below

0
On

The documentation at https://golangci-lint.run/usage/configuration/ shows all configurable options, which can be seen also with golangci-lint run -h.

In particular, I think that these two settings are the ones you are looking for:

golangci-lint run -h | grep issues | grep max
      --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)