63 var events []*Event
64
65 for len(events) != 2 {
66 select {67 case event := <-eventsChannel:
68 log.Info(event)
69 events = append(events, event)
Select statements with a single case can be replaced with a simple send or
receive. If you intend to handle the case when no value is received from
the channel, add a default
case to make the select
statement non-blocking.
select {
case x := <-ch:
fmt.Println(x)
}
x := <-ch
fmt.Println(x)