Skip to content

Glossary: Go in Practice

Wrapping errors with %w

Also written: %w, error wrapping

Using `%w` in `fmt.Errorf` keeps the original error inside the new one, so `errors.Is` still finds it. A single `Errorf` may hold two `%w` verbs.

Where the book teaches it

Related terms

errors.Iserrors.Aserrors.JoinSentinel error