← Go Programming learning path
Go Programming · Module 8 of 10

Goroutines and channels

Run concurrent work safely.

📖 Key ideas

  1. go doWork() starts a goroutine.
  2. Channels pass values between goroutines: ch := make(chan int).
  3. Send ch <- v; receive v := <-ch.
  4. sync.WaitGroup waits for goroutines; sync.Mutex protects shared data.
  5. select waits on multiple channels.
💡 Real-life example: Goroutines are workers; channels are conveyor belts passing items between them.
goroutineLightweight thread
channelTyped pipe between goroutines
WaitGroupWaits for goroutines to finish
selectWaits on multiple channel operations