package test import ( "fmt" "sync" ) func GoConsumer(mx *sync.Mutex, ch chan int) { defer mx.Unlock() for { select { case v := <-ch: mx.Lock() fmt.Println("读取到", v) mx.Unlock() } } }