Section 5 of 11

Errors are values

No exceptions, no stack unwinding. You return errors and the caller checks them.

error is an ordinary interface with one method. Nothing is thrown and nothing is caught. The verbosity is the point: every failure path is visible at the call site instead of hidden in a signature.

Wrapping, errors.Is, errors.As

go.dev playground

Try it: Swap %w for %v in the fmt.Errorf and watch errors.Is stop matching — %w is what preserves the chain.