Manage Go versions with OMG

Install Go, switch project versions with go.mod or .go-version, understand GOROOT and GOPATH tools, and verify toolchains on Linux, macOS, and WSL.

Install Go and inspect the selected runtime

OMG manages Go compiler releases and standard toolchain binaries in pure Rust without shell wrappers or external managers. It downloads official releases directly from go.dev, verifies SHA-256 archive checksums against official manifests, and unpacks the toolchain into your user-local data directory.

OMG installer artifacts target Linux and Apple Silicon macOS. On Windows, run OMG inside a supported Linux distribution in WSL; native Windows execution is not supported.

Install a Go release and inspect the selection

omg use go 1.21
omg list go
omg which go

Running omg use go records the selected version in OMG’s versions tree and updates the current symlink. The shell hook prepends that version’s bin directory to PATH when entering a directory with a matching pin, and restores your base PATH when leaving it.

Verify the active Go compiler at a fresh shell prompt

go version
which -a go

Project pins with go.mod and .go-version

When you navigate into a repository, OMG detects Go version requirements in order: .go-version, go.mod (reading the go directive), and then universal .tool-versions. The hook checks the project folder first and walks upward through parent folders. The nearest pin wins.

Partial version requests such as 1.21 automatically resolve to the newest matching stable release on go.dev, avoiding release candidates and prereleases.

Inspect available upstream Go releases and local pins

omg list go --available
cat go.mod
omg which go

GOROOT resolution and GOPATH tools

Modern Go compilers locate their standard library (GOROOT) relative to the active go binary executable path. OMG does not export a global GOROOT shell environment variable; the compiler operates directly from its directory on PATH. Upon installation, omg use go displays the detected GOROOT and PATH for verification.

Global tools compiled via go install place binaries into $GOPATH/bin (defaulting to ~/go/bin). Keep your GOPATH bin directory in your shell profile independently of OMG runtime switching.

Inspect Go environment variables and paths

go env GOROOT GOPATH
which -a go

When Go resolves to an unexpected installation

Diagnose competing Go installations

omg which go
which -a go
go version

If a system package such as /usr/bin/go appears ahead of OMG in PATH, verify that eval of omg hook for your shell is present in your shell configuration (.zshrc, .bashrc, or config.fish) and restart your shell session.

OMG is approaching beta. Consult the runtime handbook for complete storage paths, checksum verification, and version file detection precedence.

Sources and verification

Commands and behavior are based on the references below. Source review is not a claim that every workflow has been executed on every supported platform.

Read as Markdown