go: Don't allow leaked goroutines to prevent program to exit
This is the Go behaviour, as demonstratd by the following program: ---- 8< ---- package main import ( "fmt" "time" ) func work(w int) { for i := 0; ; i++ { fmt.Printf("w%d: %d\n", w, i) time.Sleep(1*time.Second) } } func main() { for i := 0; i < 100; i++ { go work(i) } time.Sleep(3*time.Second) println("main: exit") } ---- 8< ----
Showing
Please register or sign in to comment