You're bringing up exceptions rather than a rule. Sure you can find things they mess up. The whole premise of a lot of the "AI" stuff is approximately solving hard problems rather than precisely solving easy ones.
The opposite is true, they sometimes guess correctly, even a broken watch is right two times a day.
I believe future AI systems can make correct answers. The rule is clearly specified in Go specification.
BTW, I haven't found an AI system can get the correct output for the following Go code:
package main
import "fmt"
func main() {
for counter, n := 0, 2; n >= 0; n-- {
defer func(v int) {
fmt.Print("#", counter, ": ", v, "\n")
counter++
}(n)
}
}