进程花费了太长时间程序退出:Golang错误[重复]

This question already has an answer here:

I was playing with for loop in Go via Go tour

When I ran

package main

import "fmt"

func main() {
    sum := 1
    for sum < 1000 {
        sum += sum
    }
    fmt.Println(sum)
}

Program runs fine with output 1024

But when I change sum := 0

package main

import "fmt"

func main() {
    sum := 0
    for sum < 1000 {
        sum += sum
    }
    fmt.Println(sum)
}

It gives error saying

process took too long
Program exited.

EDIT: I dived myself so deep into Go tour that I could not realise, I am making a logical error :P.

</div>

Because you are adding 0 to 0 inside the loop, which always results in 0. Therefore the loop will never end as sum will always be 0.