Go for Beginners / Chapter 1 — Fundamentals (lessons 1–9) / Lesson 1

What Go is (setting up and Hello World)

Time needed: about 3 min (estimate)

☆ Read later

You can try the opening of this lesson without an account.

Three reasons to choose Go

Go is a language Google released in 2009.

Narrowed to three traits: it builds into one executable (compiling produces a single file including the runtime, so the target machine needs no Go), the syntax is small (25 keywords, no inheritance, and fewer ways to write things means you can read other people's code), and concurrency is a language feature (writing go f() runs it concurrently; lesson 46).

Infrastructure tools such as Docker, Kubernetes and Terraform are written in Go precisely for that "easy to distribute, strong at concurrency" character.

Terminal

$ brew install go # macOS. On Windows and Linux, the official installer from go.dev/dl/ is quickest $ go version go version go1.27.1 darwin/arm64 # the GOPATH setup that used to be required is unnecessary from Go 1.16, with modules # do not set GOPATH by following an old article

The first program is four lines

Create a free account to keep reading

With an account you can read the rest of this lesson, take the quiz, and read every free lesson in this course. Lessons you answer correctly are recorded as complete.

Report a problem with this lesson

Log in to send a report.

Keyboard shortcuts

Keys available in a lesson
KeyAction
[ or Alt + ←Go to the previous lesson
] or Alt + →Go to the next lesson
?Open this list
EscClose this list

The keys do not work while the cursor is in a code editor or an input field.