finds.dev

fatih/errwrap

Go tool to wrap and fix errors with the new %w verb directive

View on GitHubHomepage ↗

★ 380GoNOASSERTIONupdated Apr 2025

// the take

errwrap is a small go/analysis checker that flags fmt.Errorf calls where an error argument is formatted with %v, %s or another verb instead of %w, and can rewrite those calls with -fix. It is for Go developers who want to adopt error wrapping across an existing codebase without editing each call site by hand.

It is built on go/analysis, so it judges by type rather than text: an argument counts because its type is error, not because the format string happens to contain a verb. The analysistest suite pins both the diagnostics and the rewritten output with golden files (a.go.golden, e.go.golden), so changes to the fix show up as a diff in review. The README is candid that wrapping makes the wrapped error part of your API and that the tool does not pretend otherwise.

The last push was April 2025, about eighteen months before this evaluation, so it is unclear whether it has been exercised against recent Go releases and x/tools. -fix converts every error-typed verb to %w, and the README mentions no way to exclude a call site, so a deliberately opaque error gets wrapped anyway unless you skip that file. golangci-lint's errorlint linter has an errorf check that covers the same ground and also handles errors.Is and errors.As, so if you already run golangci-lint, that is probably the better home for this check.

We read the README, the directory tree and a key source file in October 2026. Nobody pays to be listed. How we judge →

search the same ground:

// at a glance

Stars
380
Forks
16
Language
Go
License
NOASSERTION
Last commit
7 Apr 2025

// nearby

If errwrap isn't quite it.

All repos →