Documentation
¶
Overview ¶
Package errfmt provides an analysis.Analyzer for error format strings: error construction routes through fmt.Errorf, and error wrapping routes through its %w verb.
Two checks:
- errors.New can be replaced by fmt.Errorf. Reported only: a message could contain a percent sign Errorf would interpret, so the rewrite is the author's work.
- An error formatted into another error can wrap it: an error value passed to a fmt.Errorf %v or %s verb becomes %w. The fix rewrites the verb in place and is withheld when the format's source spelling differs from its value, as with escape sequences.
Only arguments whose static type is error are considered, and only literal format strings are inspected. An indexed or star verb skips the whole call: the argument mapping is no longer positional.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Analyzer = &analysis.Analyzer{
Name: "errfmt",
Doc: "reports error formatting that bypasses fmt.Errorf or %w",
Run: run,
}
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.