errstringcheck
errstringcheck checks error message format.
Install
go install github.com/fmatzy/errstringcheck/cmd/errstringcheck@latest
Usage
errstringcheck ./...
Examples
// Bad
fmt.Errof("foo error=%v", err)
fmt.Errof("bar error=%w", err)
fmt.Errof("error %w message", err)
// Good
fmt.Errof("foo error: %v", err)
fmt.Errof("bar error: %w", err)
Options
-wraponly
: Only allow %w
verb to format error variable.