Go - Main Package
Package main
is special:
- It defines a standalone executable program (Not a library)
- The main package must have a package name
main
- It must define a function named
main
where the execution of the program begins - Program execution begins by initializing the
main
package and then invoking the functionmain
go
package main
import "fmt"
// The `main` function is the entry point of the program and is executed
// when the program is run, it takes no arguments and returns no values.
func main() {
// When the `main` function returns, the program exits.
fmt.Println("Hello, World!")
}