AiTeky Original Interactive Learning & Practice Intermediate
Go: errors as values, deferred cleanup and the upload that said success
See how Go reports failure as a returned value that is easy to ignore, how deferred cleanup runs in reverse order and piles up inside loops, and find why an upload reported success while saving nothing.
Go has no exceptions for ordinary failures. A function that can fail returns an error as a second value, and the caller must look at it. That keeps failure visible in the code, and it also makes it easy to ignore: a program that throws the error away carries on as if nothing happened. Go's defer statement schedules cleanup for when a function ends, which is tidy, but it has two traps of its own.
This course models returned errors and deferred cleanup with small Python programs you can run in your browser. Python stands in for Go: the code is not Go, but returning an error value and running deferred calls in last-in, first-out order are the real behaviour. Check the Go documentation for exact syntax, error wrapping and defer rules. All numbers are made up.
- Learn lessons explain one idea at a time and let you run it.
- Industry ready lessons decide and justify, and end with interview questions.
No Go experience is assumed. Basic Python helps.
- ▶ Run code in your browser. Nothing to install
- ✓ Exercises that check themselves
- 📖 Tap a word to see what it means
Locked. Sign up free
Learn
Understand each idea with everyday examples. No coding background needed.
- 01 25 min Free sample 🔒 AiTeky Pass The error you did not look at Model a function that returns a value and an error, see what happens when the caller ignores the error, and write the check that stops a failure being silent.
- 02 25 min 🔒 AiTeky Pass Defer runs last in, first out See that deferred calls run in reverse order when a function ends, and that a defer inside a loop holds every resource until the whole function returns.
Industry ready
Real problems from real jobs, and the questions interviewers ask about them.

