golang 只读/只写channel
//可同时读写
go func(num int, close chan struct{}) {
<-close
close <- struct{}{}
}(i,c)
//只写channel
go func(num int, close chan<- struct{}) {
<-close //error
close <- struct{}{}
}(i,c)
//只读channel
go func(num int, close <-chan struct{}) {
<-close
close <- struct{}{} //error
}(i, c)
复制代码