1
0
mirror of https://github.com/mgechev/revive.git synced 2025-01-10 03:17:11 +02:00
revive/formatter/default.go

27 lines
590 B
Go
Raw Normal View History

2018-01-28 03:01:18 +02:00
package formatter
import (
"fmt"
"github.com/mgechev/revive/lint"
)
// Default is an implementation of the Formatter interface
// which formats the errors to text.
2018-01-28 03:01:18 +02:00
type Default struct {
Metadata lint.FormatterMetadata
}
// Name returns the name of the formatter
func (f *Default) Name() string {
return "default"
}
// Format formats the failures gotten from the lint.
func (f *Default) Format(failures <-chan lint.Failure, _ lint.RulesConfig) (string, error) {
2018-01-28 03:01:18 +02:00
for failure := range failures {
2018-01-28 09:03:07 +02:00
fmt.Printf("%v: %s\n", failure.Position.Start, failure.Failure)
2018-01-28 03:01:18 +02:00
}
return "", nil
}