Go 1 min read

[Go Tutorials P1] Hello world

package main

import "fmt"

func main(){
    fmt.Print("Hello world")
}

Explanation:

package main
  • This defines the package name.
  • Every Go program must start with package declaration. 
  • main is special - it tells Go compiler that this file should be complied as an executable program(not a shared library).
  • The Go program will start execution in the main function inside the main package.