errfmt

command module
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 8 Imported by: 0

README

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 ./...

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL