aboutsummaryrefslogtreecommitdiffhomepage
path: root/compiler/testdata/channel.go
blob: ecc837a71a2835bd6b0d4e9e07943e1bdd838b97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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:
	}
}