package main

The special package name that makes a Go program executable, together with a function called main where the program starts.

In more detail

Any other package name produces a library that something else must import. When main returns, the whole program exits, even if goroutines are still running. go build on a main package produces a binary.

Example

package main

func main() {}

Related terms

Taught in

References