运行
格式化
停止
分享
赞助
//author: ysqi ,https://yushuangqi.com package main import "fmt" import "runtime" func main() { runtime.GOMAXPROCS(1) int_chan := make(chan int, 1) string_chan := make(chan string, 1) int_chan <- 1 string_chan <- "hello" select { case value := <-int_chan: fmt.Println("int_chan value:", value) case value := <-string_chan: panic("string chan error," + value) } }