github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/talks/2014/taste/concurrency1.go (about) 1 // +build OMIT 2 3 package main 4 5 import ( 6 "fmt" 7 "time" 8 ) 9 10 // f START OMIT 11 func f(msg string, delay time.Duration) { 12 for { 13 fmt.Println(msg) 14 time.Sleep(delay) 15 } 16 } 17 18 // f END OMIT 19 20 // main START OMIT 21 func main() { 22 go f("A--", 300*time.Millisecond) 23 go f("-B-", 500*time.Millisecond) 24 go f("--C", 1100*time.Millisecond) 25 time.Sleep(20 * time.Second) 26 } 27 28 // main END OMIT