Skip to content
masterclass Buddy

Go · Function

fmt.Errorf

fmt.Errorf formats values into an error. The %w verb also wraps an error so callers can inspect the underlying error.

Last updated

Since
Go 1.13

Syntax

func Errorf(format string, a ...interface{}) error

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • errors.Unwrap
  • errors.Is
  • errors.As
  • fmt.Errorf
  • %w

Source: Go Wiki: Error Values: Frequently Asked Questions. Checked 2026-11-03.