golang 方法内部定义子方法及调用
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 }