🔹Go Routine and Channel
Describe about Go routine and Channel
start := time.Now()
ch := make(chan string)
go func() {
time.Sleep(3 * time.Second)
ch <- "finish process"
}()
response := <-ch
// response
fmt.Println(response)
// time took
fmt.Println(time.Since(start))
// output
finish process
3.0012505sLast updated