# 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.

Canonical: https://getomg.xyz/runtimes/go/
Updated: 2026-09-21
Author: OMG maintainers

## 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

```sh
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

```sh
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

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

> OMG manages the Go compiler and toolchain (go and gofmt). Project dependency resolution and integrity remain with go.mod and go.sum. Do not replace Go module tooling with a runtime manager.

## 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

```sh
go env GOROOT GOPATH
which -a go
```

## When Go resolves to an unexpected installation

### Diagnose competing Go installations

```sh
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

Source-reviewed guidance; not a claim of execution on every supported platform.

- [OMG runtime handbook](https://getomg.xyz/docs/runtimes/)

- [Go download and install documentation](https://go.dev/doc/install)

- [Go modules reference](https://go.dev/ref/mod)

## Related pages

- https://getomg.xyz/docs/runtimes/

- https://getomg.xyz/runtimes/rust/

- https://getomg.xyz/guides/reproducible-dev-environments/

