package main import "fmt2" func fibonacci(c, quit chan int) { x, y := 0, 1 for { select { case c <- x: x, y = y, x+y case <-quit: fmt2.Println("quit 拉") return } } } func main() { c := make(chan int) quit := make(chan int) go func() { for i := 0; i < 12; i++ { fmt2.Println(<-c) } quit <- 0 }() fibonacci(c, quit) }