package main
import (
"fmt"
)
func bbb(rch chan string) {
a := []string{"aaaa", "bbbbb", "ccccc"}
for _, b := range a {
rch <- b
}
}
func aaa(rch <-chan string, ch chan<- bool) {
for m := range rch {
fmt.Println(m)
}
ch <- false
}
func main() {
ch := make(chan bool)
rch := make(chan string)
go bbb(rch)
go aaa(rch, ch)
<-ch
}
有疑问加站长微信联系(非本文作者))