
This works around a bug in LLVM (https://bugs.llvm.org/show_bug.cgi?id=49916) but seems like a good change in general.
25 строки
314 Б
Go
25 строки
314 Б
Go
package main
|
|
|
|
func chanIntSend(ch chan int) {
|
|
ch <- 3
|
|
}
|
|
|
|
func chanIntRecv(ch chan int) {
|
|
<-ch
|
|
}
|
|
|
|
func chanZeroSend(ch chan struct{}) {
|
|
ch <- struct{}{}
|
|
}
|
|
|
|
func chanZeroRecv(ch chan struct{}) {
|
|
<-ch
|
|
}
|
|
|
|
func selectZeroRecv(ch1 chan int, ch2 chan struct{}) {
|
|
select {
|
|
case ch1 <- 1:
|
|
case <-ch2:
|
|
default:
|
|
}
|
|
}
|