If I have a function that takes a number of read only channels (for example for channel aggregation), why can't I call this function with a slice of channels, like
package main
func f(in ...<-chan int) {
// do something
}
func main() {
chList := []chan int{make(chan int), make(chan int)}
f(make(chan int), make(chan int)) // works
f(chList...) // cannot use chList (type []chan int) as type []<-chan int in argument to f
}
It seems I'm missing something fundamental but I can't figure out what. If the function can't take unidirectional channels, why can it take them when not in the first case?