GoGo

Learn Go – all lessons

15 lessons from beginner to advanced, building on each other and with code examples.

Beginner
1

Hello World & Program Structure

Package, import, the main function and formatted output.

2

Variables, Types & Constants

var, :=, zero values, type conversion and const.

3

Conditions: if and switch

Making decisions – without parentheses and without a ternary operator.

4

Loops: for only

Go has exactly one loop construct – with many forms.

5

Functions

Multiple return values, variadic parameters and closures.

Intermediate
6

Arrays, Slices & Maps

The core collection types and their pitfalls.

7

Structs, Methods & Pointers

The Go way to "objects": data in structs, behavior in methods.

8

Interfaces

Implicit contracts, type assertions and the empty interface type.

9

Errors as Values

error returns, wrapping with %w, and errors.Is and errors.As.

10

defer, panic & recover

Guarantee cleanup and catch exceptional situations.

11

Files & JSON

Read and write text, exchange data as JSON.

Advanced
12

Goroutines & Channels

Concurrency that feels like normal code.

13

Mutex, Worker Pools & Context

Protect shared data, distribute work and cancel it.

14

Generics

Type parameters, constraints and generic types (since Go 1.18).

15

Modules, Packages & Tests

Structure projects, manage dependencies and test code.