When you’re juggling several channels, select waits on all of them at once and runs whichever is ready first:
select {
case msg := <-orders:
fmt.Println("order:", msg)
case <-quit:
fmt.Println("standing down")
}
The sync package covers the cases where channels are overkill โ sync.WaitGroup (which you’ve met) for waiting, and sync.Mutex (Lock/Unlock) to protect shared state from concurrent writes.
Your Quest
Use a select statement to receive a value from the ready channel and print it. (It’s a buffered channel that already holds "go!", so the receive is ready immediately.)
Expected output:
go!
Hint
select {
case msg := <-ready:
fmt.Println(msg)
}