You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

unix.go 712B

123456789101112131415161718192021222324252627
  1. package formatter
  2. import (
  3. "fmt"
  4. "github.com/mgechev/revive/lint"
  5. )
  6. // Unix is an implementation of the Formatter interface
  7. // which formats the errors to a simple line based error format
  8. // main.go:24:9: [errorf] should replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...)
  9. type Unix struct {
  10. Metadata lint.FormatterMetadata
  11. }
  12. // Name returns the name of the formatter
  13. func (f *Unix) Name() string {
  14. return "unix"
  15. }
  16. // Format formats the failures gotten from the lint.
  17. func (f *Unix) Format(failures <-chan lint.Failure, _ lint.Config) (string, error) {
  18. for failure := range failures {
  19. fmt.Printf("%v: [%s] %s\n", failure.Position.Start, failure.RuleName, failure.Failure)
  20. }
  21. return "", nil
  22. }