16 lines
153 B
Go
16 lines
153 B
Go
|
package main
|
||
|
|
||
|
|
||
|
func countChan(n int) <-chan int {
|
||
|
ch := make(chan int)
|
||
|
|
||
|
go func() {
|
||
|
for i := range n {
|
||
|
ch <- i
|
||
|
}
|
||
|
close(ch)
|
||
|
}()
|
||
|
|
||
|
return ch
|
||
|
}
|