github.com/HaHadaxigua/yaegi@v1.0.1/_test/select7.go (about)

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