main.go 322 B

1234567891011121314151617181920212223242526
  1. package main
  2. import (
  3. "fmt"
  4. )
  5. type Ret struct{I int ; V string}
  6. func Foo() chan Ret {
  7. ret := make(chan Ret)
  8. go func() {
  9. ret <- Ret{1, "die"}
  10. ret <- Ret{5, "cock"}
  11. ret <- Ret{8, "suck"}
  12. ret <- Ret{7, "suck"}
  13. close(ret)
  14. }()
  15. return ret
  16. }
  17. func main() {
  18. for c := range Foo() {
  19. fmt.Println(c.I, c.V)
  20. }
  21. }