package main import "fmt" func main() { ch := make(chan int ,5) ch <- 1 ch <- 2 ch <- 3 //发送完,必须close,否则dead lock close(ch) //range 遍历 取出 数据,所以,没法重复range for v := range ch{ fmt.Println(v) } for v := range ch{ fmt.Println(v) } for v := range ch{ fmt.Println(v) } }