Code

Create main.go — your first program

Create an empty folder (e.g. my-app) and inside it a file main.go with this content. What each line is:

  • package main — says this is a runnable program (not a library).
  • import "fmt" — pulls in the standard package for printing.
  • func main() — the program starts here. Always.
  • fmt.Println(...) — prints a line and moves to the next one.

The second Println holds the theme of your future app. Leave the sample one ("book list") for now — you will pick your own in step 4.

Verify. In a terminal, inside the folder:

go run main.go

You must see exactly:

Hello! This is my first Go program.
My app: book list

Tip. If the go command is not found, Go isn't installed yet — download it from go.dev/dl. And if you want to try without installing anything, open go.dev/play, paste the same code and press "Run": same result.