Loading…
0+ curated questions with the same answer shape every time: quick recap, deep dive, pitfalls, and follow-ups. Coverage includes .
Go error handling is idiomatic, explicit, and deliberately different from try/catch — and every interviewer will probe whether you understand why. This module covers the error interface (the simplest interface in Go: one method, Error() string), the idiomatic pattern of returning (value, error) from functions, wrapping errors with fmt.Errorf('...: %w', err) to preserve the error chain, errors.Is for identity checks and errors.As for type-based extraction, sentinel errors (var ErrNotFound = errors.New) for known expected conditions, and custom error types that carry additional context. The panic/recover mechanism is covered with the rule that separates idiomatic Go from Go written by Java developers: panic is for programmer errors and unrecoverable states; expected error conditions always use the error return value. Every answer includes the trade-off between verbosity and explicitness that makes Go error handling polarising.
Full catalog
Topics are ordered for learning. Within each topic, rows are numbered 1–0 globally so you always know where you are. Collapse topics if you want a lighter view — use Expand all when you need the full list again.
Numbers 1–0 follow the order we recommend — click any row to open the full answer, or use the sticky Next link at the bottom of each page to go Q1 → Q0.