Wrong:
func test() (c ch string) {
c <- "test"
return
}
Right:
func test() (c ch string) {
c = make(chan string)
c <- "test"
return
}
Wrong:
func test() (c ch string) {
c <- "test"
return
}
Right:
func test() (c ch string) {
c = make(chan string)
c <- "test"
return
}