Golang Channels (chan) in 5 Minutes
Go channels for beginners, in five minutes, on a real Go program: why one send into a channel crashes with 'all goroutines are asleep - deadlock!', what an unbuffered channel really is (a hand-off, not a mailbox), what a buffer of three slots changes, and why a range over a channel deadlocks after the last value until the sender calls close.
Not a mailbox
Your Go program crashed: all goroutines are asleep, deadlock. All it did was send into a channel. In five minutes: what a channel is, and three crashes beginners hit.

Most beginners picture a channel as a mailbox: drop a value in, pick it up later. Sue thought so too: her program loads the hay truck for Rich's horses.

Her program makes a channel, sends an order with an arrow pointing into orders, then takes it out with an arrow pointing out. Same crash. And it's not the last one.
sed -n '6,8p' main.goorders := make(chan string) orders <- "20 bales for Rich" fmt.Println("loading:", <-orders)
go run .fatal error: all goroutines are asleep - deadlock! goroutine 1 [chan send]: main.main() /home/sue/hay/main.go:7 +0x38 exit status 2
A hand-off
So what is a channel? Not a box, but a hand-off. A send waits until someone receives, and a receive waits until someone sends. Main sent, and then waited for someone to receive. But the only receiver was main itself, on the very next line, so nobody ever came. So Sue moves the send into a small function, and starts it with the word go. That makes it a goroutine: a function running alongside main. Now one side sends, the other receives, and the order gets through.
sed -n '6,10p' main.goorders := make(chan string) go func() { orders <- "20 bales for Rich" }() fmt.Println("loading:", <-orders)
go run .loading: 20 bales for Rich
Rich and his horses are waiting on twenty bales. And Sue's real program sends four orders before the driver shows up. A hand-off can't hold them: they need somewhere to wait.

Think of passing a bale by hand, from Sue in the loft to the driver. She can't let go until he takes it: an unbuffered channel.
Put a cart between them, and she can drop in three bales before he takes one. That cart is called a buffer.
Go's specification says the same: with no buffer, both sides must be ready. With a buffer, a send only waits when it's full.

A cart with slots
Sue has four orders, and the driver isn't there yet to take them. Can a channel hold them? You create a channel with make, and Sue's first one had no number, so no slots. Put a number after chan string, here three, and the channel gets a buffer with three slots. Now she can send three orders with nobody receiving yet. The len function counts the orders waiting, and cap counts how many fit: three of three.
sed -n '6,11p' main.goorders := make(chan string, 3) orders <- "20 bales for Rich" orders <- "12 bales for Oak Stables" orders <- "8 bales for the riding school" fmt.Println("on the cart:", len(orders), "of", cap(orders)) fmt.Println("loading:", <-orders)
go run .on the cart: 3 of 3 loading: 20 bales for Rich
Then a fourth order comes in: thirty bales for Maple Farm. The cart is full, and nobody is unloading. Guess first: does Go drop an order, or wait? It waits, forever. Same crash, and look at the line under it: goroutine one is stuck on a chan send.
sed -n '10,11p' main.gofmt.Println("on the cart:", len(orders), "of", cap(orders)) orders <- "30 bales for Maple Farm"
go run .on the cart: 3 of 3 fatal error: all goroutines are asleep - deadlock! goroutine 1 [chan send]: main.main() /home/sue/hay/main.go:11 +0x108 exit status 2
The rule behind these crashes: a send needs a receiver, or a free slot. When every goroutine is waiting, Go stops the program. That's on purpose: a program that stops loudly beats one that hangs silently. The idea goes back to a 1978 paper by Tony Hoare.

Saying you're done
A full cart needs someone unloading it. So Sue moves the sending into a loader goroutine, and main takes each order off the channel with a for loop using range. All four get delivered, and then: deadlock, this time stuck on a chan receive. And a bigger cart won't fix this one.
sed -n '6,15p' main.goorders := make(chan string) go func() { for _, o := range todaysOrders { orders <- o } }() for o := range orders { fmt.Println("delivered:", o) } fmt.Println("all orders delivered")
go run .delivered: 20 bales for Rich delivered: 12 bales for Oak Stables delivered: 8 bales for the riding school delivered: 30 bales for Maple Farm fatal error: all goroutines are asleep - deadlock! goroutine 1 [chan receive]: main.main() /home/sue/hay/main.go:12 +0xe0 exit status 2
Why? A range over a channel keeps receiving until the channel is closed. The loader finished its four sends and returned, but nobody told main there were no more. So main waits for a fifth, every goroutine is asleep, and Go stops.

Sue adds one line after her loader's loop: a call to close, with orders inside. Only the sender closes.

Run it again. Four deliveries, then it prints: all orders delivered. And the program ends on its own. One more detail: receiving from a closed channel never waits. Receive into two variables, o and ok, and ok tells you if the channel is still open. On a closed channel, o is an empty string, and ok is false.
sed -n '7,12p' main.gogo func() { for _, o := range todaysOrders { orders <- o } close(orders) }()
go run .delivered: 20 bales for Rich delivered: 12 bales for Oak Stables delivered: 8 bales for the riding school delivered: 30 bales for Maple Farm all orders delivered after close: "", ok = false
sed -n '17,18p' main.goo, ok := <-orders fmt.Printf("after close: %q, ok = %v\n", o, ok)
Next morning, the program runs to the end. The truck is loaded, and Rich gets his twenty bales.

Recap
So: a channel is a hand-off, not a mailbox. A send waits for a receiver or a free slot in the buffer. And the sender closes the channel, so a range knows when to stop.

If channels finally make sense, a like helps YouTube show this to more beginners, and subscribing brings the next Go idiom: type assertions.
The lab files and every command are linked in the description. Thanks for watching Cloud Explainers.
Sources
Demos: one container on our own Mac standing in for a laptop; the hay business and its orders are made up. Every command, output and number was real. Watch the full video on YouTube.