github.com/traefik/yaegi@v0.15.1/_test/select8.go (about)

     1  package main
     2  
     3  type T struct {
     4  	c1 chan string
     5  	c2 chan string
     6  }
     7  
     8  func main() {
     9  	t := &T{}
    10  	t.c1 = make(chan string)
    11  
    12  	go func(c chan string) { c <- "done" }(t.c1)
    13  
    14  	select {
    15  	case msg := <-t.c1:
    16  		println("received from c1:", msg)
    17  	case <-t.c2:
    18  	}
    19  	println("Bye")
    20  }
    21  
    22  // Output:
    23  // received from c1: done
    24  // Bye