Appendix A. Installation steps
Getting started focuses on installing the Go toolchain and confirming your setup. The text notes that Go’s compiler and tools have been written in Go itself since 1.3 and are open source, encouraging exploration of the standard library. Installation is straightforward on Linux, macOS, and Windows: download the installer, add Go to your PATH, and favor the latest release (the book uses Go 1.23). You can verify a successful setup from any directory by checking the version to confirm that Go is properly installed and available on your system.
Go relies on environment settings with sensible defaults, all visible via the go env command. While you rarely need to change them, values can be overridden temporarily with standard environment variables or persisted using go env -w, which writes to the configuration file indicated by GOENV. Key variables include GOBIN (where binaries installed via go install are placed), GOPATH (the set of directories used for resolving and caching dependencies; ensure your workspace is included), and GOROOT (the Go installation directory; avoid modifying it and keep its bin directory on PATH for tools like go and gofmt).
To validate the toolchain, create a small Hello World program, initialize a module with go mod init, and run it with go run. From there, you can bring in external work in two complementary ways: go install fetches and builds command-line tools as binaries into GOBIN, supporting explicit versions, latest, or project-scoped resolution; go get retrieves source dependencies for your project, updates go.mod, and downloads code into the module cache, with support for tags, branches, or specific commits. With these essentials, you can install Go, understand its environment, run your first program, and manage tools and libraries confidently.
A.6 Code editors
Go is supported by more and more code editors. As always in this situation, the best tool is the one you know how to use. The official Go website, as we write, lists three editors:
- GoLand, by JetBrains. JetBrains has a long list of editors for various languages, the most famous being IntelliJ for Java. You can install GoLand as a standalone editor or add the Go plugin to any other editor in the list.
- Visual Studio Code, by Microsoft, has a Go extension.
- vim-go is great if you already know vim
A quick search around the web will easily give you instructions to add Go support to your usual tool, if it is not already there, e.g. with GoSublime, Atom with GoPlus, LiteIDE…
Go is now installed on your machine and you can start using it and follow the book’s instructions. We learned about the Go environment variables and important paths. Your terminal knows how to greet you in English using Go, you can move to Chapter 2 and teach it to greet you in other human languages.
Learn Go with Pocket-Sized Projects ebook for free