1
0
mirror of https://github.com/mgechev/revive.git synced 2025-07-15 01:04:40 +02:00

Use goroutines

This commit is contained in:
mgechev
2018-01-23 17:14:23 -08:00
parent 1dc6e7cabd
commit 5c6de19f89
6 changed files with 27 additions and 15 deletions

View File

@ -33,16 +33,17 @@ func formatFailure(failure linter.Failure) []string {
}
// Format formats the failures gotten from the linter.
func (f *CLIFormatter) Format(failures []linter.Failure) (string, error) {
func (f *CLIFormatter) Format(failures <-chan linter.Failure) (string, error) {
var result [][]string
var totalErrors = 0
for _, f := range failures {
var total = 0
for f := range failures {
result = append(result, formatFailure(f))
total++
if f.Type == linter.FailureTypeError {
totalErrors++
}
}
total := len(failures)
ps := "problems"
if total == 1 {
ps = "problem"