Why Go's channel can close twice?
问题 When I am do some go practices code, I encounter a problem that a channel can be closed twice like this: // jobs.go package main import ( "fmt" ) func main() { fmt.Println("Hello, playground") jobs := make(chan int, 5) done := make(chan bool) go func() { for { j,more := <-jobs fmt.Println("receive close: ", j, more) done <- true } }() close(jobs) <- done } Output: ~ go run jobs.go Hello, playground receive close: 0 false receive close: 0 false But when I close the channel twice manually, I