Keyword

Go go keyword

Starts the specified function in a new goroutine; evaluation of the function and arguments occurs in the caller. The caller does not wait for completion automatically. Coordinate completion explicitly; the example receives a result before main exits.

Formal Syntax & Structure

go syntaxgo
go functionCall

Working Example

Example Snippetgo
package main
import "fmt"
func main() {  done := make(chan int)  go func(n int) { done <- n * 2 }(9)  fmt.Println(<-done)}
Go Reference