There is something wrong with the compiler or my understanding of Go. I have a weird bug and have whittled it down to a simple example. For some reason I can't change the array directly within a loop.
var nums [2]int
for i, v := range nums {
if i == 0 {
nums[i+1]++
} else {
fmt.Print(v)
}
}
This increments nums[1] then prints it. So it should print 1 but it prints 0.