package main import ( "fmt" "time" ) type Cat struct { Name string } func main() { var ch chan interface{} ch = make(chan interface{},2) cat1 := Cat{Name: "hell"} ch <- cat1 a := <- ch // go类型断言 cat,ok := a.(Cat) fmt.Println(ok) fmt.Println(cat.Name) fmt.Println("main") time.Sleep(time.Second) }