Home/Tutorials/Go (Golang)/Package Main and fmt.Println

0 of 3 saved

Go (Golang)5 min read

Package Main and fmt.Println

Read this chapter, write the program on this page, then pass a short check to open the next one.

Your first Go program.

Package Main and fmt.Println

Every executable Go program is package main. Import fmt and call fmt.Println to print a line.

  • package main is required for executables.
  • import "fmt" brings in formatting helpers.
  • func main() is the entry point.
package main

import "fmt"

func main() {
    fmt.Println("Greetings from Golang!")
}

After you read this chapter, use Write (when available) and Quiz on this page to lock it in — same flow as C, Python, and the other Learn languages.