Primitives for Gos
Concurrency primitives in Go are goroutines, channels and the sync package. A goroutine is a lightweight function running concurrently, managed by the Go runtime. Channels pass values between goroutines safely, and tools such as sync.WaitGroup, Mutex and Once coordinate shared access and completion.
Stage: Concurrency · Part of the Go roadmap · Last reviewed 19 November 2026
What to learn in Primitives
- Start goroutines and wait for them with sync.WaitGroup
- Send and receive on buffered and unbuffered channels
- Use select to wait on several channels or a timeout
- Protect shared data with sync.Mutex and sync.RWMutex
- Close a channel correctly and range over it
Primitives interview questions
What is the difference between buffered and unbuffered channels?
An unbuffered channel blocks the sender until a receiver takes the value, synchronising both goroutines. A buffered channel lets senders continue until the buffer is full and receivers wait only when it is empty, decoupling their timing.
What does the Go proverb about sharing memory mean?
It says to share memory by communicating, rather than communicate by sharing memory. Pass data between goroutines over channels so one goroutine owns it at a time, and use mutexes only where shared state is simpler.
Where Primitives fits in the Go roadmap
Primitives belongs to the Concurrency stage (intermediate level), which takes about 20 hours. Go's strength.