github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/compiler/testdata/channel.go (about) 1 package main 2 3 func chanIntSend(ch chan int) { 4 ch <- 3 5 } 6 7 func chanIntRecv(ch chan int) { 8 <-ch 9 } 10 11 func chanZeroSend(ch chan struct{}) { 12 ch <- struct{}{} 13 } 14 15 func chanZeroRecv(ch chan struct{}) { 16 <-ch 17 } 18 19 func selectZeroRecv(ch1 chan int, ch2 chan struct{}) { 20 select { 21 case ch1 <- 1: 22 case <-ch2: 23 default: 24 } 25 }