package example func worker(id int, results chan<- int) { results <- id * id } func fanOut() { results := make(chan int) for i := 0; i < 4; i++ { go worker(i, results) } for i := 0; i < 4; i++ { <-results } } func background(fn func()) { go fn() } func pipeline() { ch := make(chan string) go func() { ch <- "hello" }() msg := <-ch _ = msg }