github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/talks/2014/go4java/conc2.go (about)

     1  // +build OMIT
     2  
     3  package main
     4  
     5  import (
     6  	"fmt"
     7  	"time"
     8  )
     9  
    10  func sleepAndTalk(t time.Duration, msg string) {
    11  	time.Sleep(t)
    12  	fmt.Printf("%v ", msg)
    13  }
    14  
    15  func main() {
    16  	go sleepAndTalk(0*time.Second, "Hello")
    17  	go sleepAndTalk(1*time.Second, "Gophers!")
    18  	go sleepAndTalk(2*time.Second, "What's")
    19  	go sleepAndTalk(3*time.Second, "up?")
    20  }