github.com/llvm-mirror/llgo@v0.0.0-20190322182713-bf6f0a60fce1/test/execution/chan/select.go (about) 1 // RUN: llgo -o %t %s 2 // RUN: %t 2>&1 | FileCheck %s 3 4 // CHECK: sent a value 5 // CHECK-NEXT: received 123 6 // CHECK-NEXT: default 7 8 package main 9 10 func f1() { 11 c := make(chan int, 1) 12 for i := 0; i < 3; i++ { 13 select { 14 case n, _ := <-c: 15 println("received", n) 16 c = nil 17 case c <- 123: 18 println("sent a value") 19 default: 20 println("default") 21 } 22 } 23 } 24 25 func main() { 26 f1() 27 }