You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
This lesson walks you through installing Go, setting up your workspace, creating your first module, and writing, building, and running your first Go program.
Go can be installed from go.dev/dl. Downloads are available for all major platforms:
| Platform | Installation Method |
|---|---|
| macOS | .pkg installer or brew install go |
| Windows | .msi installer or choco install golang |
| Linux | Extract the tarball to /usr/local |
After installing, open a terminal and run:
go version
You should see output like:
go version go1.22.0 linux/amd64
go env GOPATH # Where Go stores downloaded modules (~/ go by default)
go env GOROOT # Where Go itself is installed
go env GOOS # Target operating system
go env GOARCH # Target architecture
Go uses modules to manage dependencies. Every Go project starts with a module.
mkdir hello
cd hello
go mod init example.com/hello
This creates a go.mod file:
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.