Learn Go – all lessons
15 lessons from beginner to advanced, building on each other and with code examples.
Beginner
12345
Hello World & Program Structure
Package, import, the main function and formatted output.
Variables, Types & Constants
var, :=, zero values, type conversion and const.
Conditions: if and switch
Making decisions – without parentheses and without a ternary operator.
Loops: for only
Go has exactly one loop construct – with many forms.
Functions
Multiple return values, variadic parameters and closures.
Intermediate
67891011
Arrays, Slices & Maps
The core collection types and their pitfalls.
Structs, Methods & Pointers
The Go way to "objects": data in structs, behavior in methods.
Interfaces
Implicit contracts, type assertions and the empty interface type.
Errors as Values
error returns, wrapping with %w, and errors.Is and errors.As.
defer, panic & recover
Guarantee cleanup and catch exceptional situations.
Files & JSON
Read and write text, exchange data as JSON.
Advanced