github.com/EngineerKamesh/gofullstack@v0.0.0-20180609171605-d41341d7d4ee/volume1/section4/goroutinesdemo/goroutinesdemo.go (about)

     1  // An example of a goroutine.
     2  package main
     3  
     4  import (
     5  	"fmt"
     6  )
     7  
     8  func printGreetings(source string) {
     9  
    10  	for i := 0; i < 9; i++ {
    11  		fmt.Println("Hello Gopher!", i, source)
    12  	}
    13  }
    14  
    15  func main() {
    16  
    17  	go printGreetings("goroutine")
    18  	printGreetings("main function")
    19  
    20  }