The following doesn't produce the expected output:
package main
var strch = make(chan string)
func main() {
strch := strch // comment this line to avoid the bug
go func() {
println("sending...")
strch <- "hello"
println("sent!")
}()
println(<-strch)
}
There appears to be some sort of interaction between closures and channel operations that goes wrong.