Off-by-one errors are common in loops:
nums := []int{1, 2, 3}
// Bug: should be i < len(nums)
for i := 0; i <= len(nums); i++ {
fmt.Println(nums[i]) // Panics on last iteration
}
Use < for zero-based indices, not <=. A slice of length has valid indices , , . Index is out of bounds. When in doubt, trace through your loop by hand.