Variables declared in the loop init are scoped to the loop:
for i := 0; i < 3; i++ {
fmt.Println(i)
}
// i is not accessible here
If you need the variable after the loop, declare it before:
var i int
for i = 0; i < 3; i++ {
fmt.Println(i)
}
fmt.Println("Final:", i) // 3