github.com/EngineerKamesh/gofullstack@v0.0.0-20180609171605-d41341d7d4ee/volume1/section4/goroutinewithdelay/goroutinewithdelay.go (about) 1 // An example of a goroutine with a delay introduced so the goroutine can complete. 2 package main 3 4 import ( 5 "fmt" 6 "time" 7 ) 8 9 func printGreetings(source string) { 10 11 for i := 0; i < 9; i++ { 12 fmt.Println("Hello Gopher!", i, source) 13 } 14 time.Sleep(time.Millisecond * 1) 15 } 16 17 func main() { 18 19 go printGreetings("goroutine") 20 printGreetings("main function") 21 22 }