Write robust, idiomatic Go by treating errors as ordinary values you return, check, wrap and inspect. You will master fmt.Errorf with %w, errors.Is and errors.As, sentinel and custom error types, disciplined panic/recover, and the effective-Go style that reviewers expect.
Watch the free preview
The error interface and returning errors — free to watch, no account needed.
What you'll learn
- Write robust, idiomatic Go that returns and handles errors as ordinary values
- Wrap errors with fmt.Errorf and %w to preserve context and cause
- Inspect error chains correctly with errors.Is and errors.As
- Design sentinel errors and custom error types for a clean public API
- Use panic and recover sparingly and follow effective-Go style
Syllabus
Errors Are Values
The error interface and returning errorsFree preview
Checking, comparing and formatting errors
Wrapping and Inspecting Errors
Wrapping errors with fmt.Errorf and %w
errors.Is and errors.As
Designing Error Values
Sentinel errors
Custom error types
Panics and Idiomatic Style
panic and recover, used sparingly
Idioms and effective-Go style
Lab — 10 Exercises & Solutions
Exercises 1–5
Exercises 6–10