Loading…
40+ curated questions with the same answer shape every time: quick recap, deep dive, pitfalls, and follow-ups. Coverage includes function signatures, multiple return values, named return values, closures and captured variables, and more.
Suggested path
Topics follow a teaching order. Each answer ends with a clear Next question control so you can move forward without hunting the list.
Go functions are first-class values — you can assign them to variables, pass them as arguments, and return them from other functions. This module covers Go's function syntax (named functions vs anonymous function literals), multiple return values (the Go idiom of returning a result and an error together — (value, error)), named return values and why they are sometimes useful and sometimes confusing, closures in Go (how a function literal captures variables from its enclosing scope, the loop variable capture gotcha that catches everyone once), variadic functions (the ...T syntax, how to spread a slice into a variadic call), defer (how deferred calls execute LIFO at function return, the argument evaluation timing — a common interview trick question), and panic/recover as the last-resort mechanism for genuinely unrecoverable errors. These fundamentals underpin every pattern in more advanced Go code.
Full catalog
Topics are ordered for learning. Within each topic, rows are numbered 1–40 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–40 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 → Q40.