github.com/switchupcb/yaegi@v0.10.2/_test/chan9.go (about)

     1  package main
     2  
     3  type Channel chan string
     4  
     5  type T struct {
     6  	Channel
     7  }
     8  
     9  func send(c Channel) { c <- "ping" }
    10  
    11  func main() {
    12  	t := &T{}
    13  	t.Channel = make(Channel)
    14  	go send(t.Channel)
    15  	msg := <-t.Channel
    16  	println(msg)
    17  }
    18  
    19  // Output:
    20  // ping