errfmt

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2026 License: BSD-3-Clause Imports: 6 Imported by: 0

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.

Directories

Path Synopsis
cmd
errfmt command

Jump to

Keyboard shortcuts

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