Packages and Hello World
In Go, code lives in packages.
A package is a folder of related .go files that share one name.
Think of a package as a toy box. Toys that belong together stay in the same box.
package main
Programs you can run use package main.
Libraries use other names you choose.
When you say go run, Go looks for package main.
func main is the front door
Go calls func main when the program starts.
That function is the starting door of your program.
Put your first steps inside main.
Imports
Use import to bring in another package.
fmt is the standard package for printing.
You can import one package or a group in parentheses.
Println vs Printf
Println prints values with spaces and a newline.
Printf lets you shape the text with markers like %s and %d.
%s means string. %d means whole number.
A tiny complete program
Every complete example in this course starts with package main.
You import what you need. Then you write func main.
Remember the pattern: package, import, then func main.
Test yourself
Three quick questions made just for this lesson. Earn 10 XP per correct answer.