package main import ( "fmt" "time" ) func main() { done := make(chan int64) go func() { for i := 0; i < 5; i++ { fmt.Println(i) time.Sleep(1 * time.Second) } done <- 10 // send }() x := <- done // receicve fmt.Println(x) // 10 }