package main
import "fmt"
func x(foo []string, cz chan string) {
for i := range foo {
cz <- foo[i]
}
}
func y(foo []string, cz chan string) {
for i := range foo {
cz <- foo[i]
}
}
type cz struct {
cSlice []chan string
}
func main() {
var quality []string = make([]string, 2)
quality[0] = "hello"
quality[1] = "world"
//name := []string{"mother", "earth"}
var channel cz
for i := range channel.cSlice {
go x(quality, channel.cSlice[i])
go y(quality, channel.cSlice[i])
x, y := <-channel.cSlice[i], <-channel.cSlice[i]
fmt.Println(x, y)
}
}
现在什么也没有收到……
更新^
...需要更多文本。
...然后再说一点。好,还有多少?
我真的不敢相信。 fdsaf asf asfasdfdasfadfd
答案 0 :(得分:1)
cannot use channel.cSlice (type chan []string) as type []chan string in argument to x
cannot use channel.cSlice (type chan []string) as type []chan string in argument to y
阅读错误消息。
type chan []string
type []chan string
它们是不同的。