goroutines done channel unbuffered channel
In unbuffered channel by default sends and receives block until both the sender and receiver are ready. package main import ( "fmt" "time" ) func worker(done chan bool) { fmt.Print("working…") fmt.Println("done") done <- true } func main() { done := make(chan bool) go worker(done) time.Sleep(5 * time.Second) <-done } But the above code is executed… Read More goroutines done channel unbuffered channel