Skip to content

tomhutch/errfmt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Errfmt

A Golang linter that checks whether wrapped errors have a consistent format. The expected format has the message begin with the function call that last assigned a value to the wrapped error, e.g.:

_, err := fmt.Scanf("")
if err != nil {
    return fmt.Errorf("fmt.Scanf: %w", err)
}

For examples of other scenarios check the testdata directory.

Installation

go install github.com/tomhutch/errfmt

Usage

The errfmt linter is called using the following format: errfmt [-flag] [package]. Where [package] can be a Golang package, a filepath or ./... for all files recursively, e.g.:

errfmt ./...

Apply suggested fixes using the -fix flag:

errfmt -fix ./...

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •