Installing Go
To build Go programs you need the Go toolchain: the compiler, the standard library and the go command that ties them together. It's a single free download for Windows, macOS and Linux and needs no other software. This lesson installs Go 1.27, checks that it works, and sets up an editor.
Downloading Go
Official installers for every platform are on go.dev/dl. Pick the newest stable version (1.27.x or later) for your operating system and processor: amd64 for most Intel and AMD machines, arm64 for Apple silicon Macs and ARM laptops.
Windows
Run the .msi installer and accept the defaults. It installs Go into C:\Program Files\Go and adds its bin folder to your PATH. Alternatively, use the Windows package manager:
winget install GoLang.Go
macOS
Run the .pkg installer from go.dev, which installs into /usr/local/go, or use Homebrew:
brew install go
Go 1.27 needs macOS 13 Ventura or later.
Linux
Distribution packages are often a few versions behind, so the official tarball is the usual choice. Remove any previous installation, unpack the archive into /usr/local, and add Go to your PATH:
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.27.1.linux-amd64.tar.gz
echo 'export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin' >> ~/.profile
source ~/.profile
The second folder, $HOME/go/bin, is where go install puts programs you install later (lesson 4).
Checking the installation
Open a new terminal and ask for the version:
go version
go version go1.27.1 darwin/arm64
The last part names the operating system and processor the toolchain targets, such as windows/amd64 or linux/amd64. Any version from 1.27 onward works for this course. If the command isn't found, the Go bin folder isn't on your PATH — reopen the terminal, or log out and back in.
Useful commands to know
| Command | What it does |
|---|---|
go version | Shows the installed version |
go env | Lists Go's settings, such as GOROOT (where Go is installed), GOPATH (your Go workspace, by default ~/go) and GOOS/GOARCH |
go help | Lists every subcommand; go help build explains one |
go doc fmt.Println | Shows documentation for a package or function in the terminal |
Keeping Go up to date
Go releases a new version every six months and bug-fix releases (1.27.1, 1.27.2, …) in between. To upgrade, install the new version the same way. Projects can also say which Go version they need in their go.mod file; if your installed Go is older, the go command can download the right toolchain automatically. You'll meet go.mod in lesson 4.
Choosing an editor
| Editor | Notes |
|---|---|
| Visual Studio Code | Free. Install the official Go extension; it sets up gopls, Go's language server, for completion, errors as you type, go-to-definition and formatting on save. |
| GoLand | JetBrains' dedicated Go IDE, with strong refactoring and a built-in debugger. |
| Vim, Neovim, Emacs, Zed, Helix… | All support gopls through their language-server plugins. |
Whatever you choose, turn on format on save. Go code is always formatted with gofmt, which uses tabs for indentation — you never have to line things up by hand.
Running Go without installing
The Go Playground at go.dev/play compiles and runs small programs in your browser. It's handy for quick experiments and for sharing snippets, but it can't read your files or wait for keyboard input, so install Go locally for this course.