golang: goroute with select doesn't stop unless I added a fmt.Print()
问题 I tried the Go Tour exercise #71 If it is run like go run 71_hang.go ok , it works fine. However, if you use go run 71_hang.go nogood , it will run forever. The only difference is the extra fmt.Print("") in the default in the select statement. I'm not sure, but I suspect some sort of infinite loop and race-condition? And here is my solution. Note: It's not deadlock as Go didn't throw: all goroutines are asleep - deadlock! package main import ( "fmt" "os" ) type Fetcher interface { // Fetch