package main import ( "fmt" "reflect" ) func out(ch chan int) { <-ch fmt.Println(" test out func define") } func main() { //-----------------外部方法-------------------- ch := make(chan int) go out(ch) ch <- 1 //-----------------内部方法-------------------- cha := make(chan int) var c = func(cha chan int) { <-cha fmt.Println(" test iner func define") } go c(cha) cha <- 1 }
有疑问加站长微信联系(非本文作者)