Go 1.27
A hands-on introduction to Go,
one annotated example at a time.
Each example is a complete program. The comments explain the code next to them, and the output underneath is what the program really prints. Start at the top for the language basics, or jump to the part of the standard library you need.
Examples
91
Topics
16
Standard library packages
49
Lines of Go
6,178
Basics01–07
Collections08–11
Functions12–16
Types and methods17–24
Generics and iterators25–26
Errors27–31
Concurrency32–51
32Goroutines33Channels34Channel Buffering35Channel Synchronization36Channel Directions37Select38Timeouts39Non-Blocking Channel Operations40Closing Channels41Range over Channels42Timers43Tickers44Worker Pools45WaitGroups46Rate Limiting47Atomic Counters48Mutexes49Stateful Goroutines50Sync Once and Pool51Context