alecthomas / gometalinter

DEPRECATED: Use https://github.com/golangci/golangci-lint
MIT License
3.51k stars 267 forks source link

Deduplicate output #117

Closed dominikh closed 8 years ago

dominikh commented 8 years ago

When running on invalid code (that doesn't typecheck or has syntax errors), most tools will output the same error, For example:

$ gometalinter               
somefile.go:1:1:warning: expected 'package', found 'IDENT' gibberish (golint)
somefile.go:1:1:warning: expected 'package', found 'IDENT' gibberish (gosimple)
somefile.go:1:1:warning: expected 'package', found 'IDENT' gibberish (staticcheck)

This will cause editors to display multiple errors for a line of code. It would be great if gometalinter could coalesce these errors into a single one. Either something like this:

somefile.go:1:1:warning: expected 'package', found 'IDENT' gibberish (golint, gosimple, staticcheck)

or even without the list of linters at the end.

alecthomas commented 8 years ago

gometalinter streams messages as soon as it sees them, by design. In order to coalesce it would need to buffer them. The streaming behaviour is desirable and the downside of having a few duplicated mesages is not high enough to lose that feature.

alecthomas commented 8 years ago

I should say that I'm not actually opposed to supporting this via a flag, as with --sort (which buffers).

dominikh commented 8 years ago

Okay. I'll send a PR later.

casimir commented 8 years ago

@dominikh Did you send the PR? Can't find it.

dominikh commented 8 years ago

@casimir I'm sorry, no I haven't.

casimir commented 8 years ago

@dominikh no problem just needed it. If I can I'll send a PR soon then.