Infinite loops happen when the termination condition is never met:
// Bug: i is always less than 10
for i := 0; i < 10; {
fmt.Println(i)
// Forgot to increment i!
}
Always verify your loop will terminate. Check that the condition can become false and that your post statement moves toward that condition. Debuggers and print statements help identify stuck loops.