Setting Up Go
Before tally can count anything, your computer needs the Go toolchain. The good news: Go ships as one download, and a single command, go, compiles, runs, tests and formats everything.
The rule
Install one toolchain, start one module, and let
godrive.
Install. Download the installer for your system from the official site, go.dev, or use a package manager such as Homebrew (brew install go). Then check it in a new terminal:
go versionIf it prints a line such as go version go1.26.0 darwin/arm64, Go is installed and on your PATH. The version number on your machine may differ; anything recent is fine.
Start a module. A module is a folder of Go code with a go.mod file at its root. The file names the module and records which Go version and which outside packages it needs.
mkdir tally
cd tally
go mod init example.com/tallyThat creates:
module example.com/tally
go 1.26The module path looks like a web address because shared modules are usually named after where they live, such as github.com/you/tally. For a private project any sensible name works.
Let go drive. You do not configure a build system. go run, go build and go test read go.mod and work out the rest. If a module asks for a newer Go than you have, the go command can even download that toolchain for you.
A few names you will see:
GOROOTis where Go itself is installed. You rarely touch it.GOPATH(by default~/go) holds downloaded modules and installed tools. Old tutorials say your code must live inside it; with modules, that is no longer true. Put projects anywhere.go envprints all these settings.
For an editor, install the Go extension for VS Code or use GoLand. Both talk to gopls, the Go language server, for completion, jump-to-definition and live errors.
The shortcut
Every new project is the same three moves: check, make a folder, init.
Check
go versionprints a version, so the toolchain works.
The classic mistake is copying an old tutorial that sets up $GOPATH/src/... folders by hand. Modules replaced that workflow years ago.
Drills
Answer fast — trust the rule.
Which command confirms that Go is installed and on your PATH?
What does go mod init example.com/tally create?
Where must a modern Go project live?
What is gopls?
Remember
- Install one toolchain, start one module, and let
godrive. - Shortcut: check (
go version), make a folder,go mod init. - Trap: old GOPATH-only tutorials; with modules your code can live anywhere.
