Can mise Manage Go Versions? Yes—Here’s How It Works for Toolchains and Packages

Yes, mise manages both the Go compiler toolchain and individual Go packages through distinct backend implementations that handle version resolution, installation, and environment configuration.

The jdx/mise repository provides first-class Go support through two complementary systems. You can pin and switch between Go runtime versions for different projects, while also treating Go-based CLI tools as version-locked dependencies managed through the same interface.

How mise Handles the Go Toolchain

The core Go plugin located in src/plugins/core/go.rs manages the Go compiler itself. This plugin implements the Backend trait and provides full lifecycle management for the language runtime.

Version Discovery and Installation

The plugin discovers available versions by filtering tags from the official Go repository in the list_remote_versions function【src/plugins/core/go.rs†L22-L84】. When you request a specific version, mise downloads the official binary tarball via the get_tarball_url function【src/plugins/core/go.rs†L147-L176】, which constructs URLs pointing to the configured mirror.

Environment Configuration

After installation, the plugin automatically configures critical Go environment variables:

  • GOROOT – Points to the installed Go directory
  • GOPATH – Manages the workspace location
  • GOBIN – Sets the binary output directory

Additionally, the plugin supports install_default_packages for pre-installing global tools whenever you switch Go versions【src/plugins/core/go.rs†L67-L100】.

Installing Go Packages as Tools

Beyond the compiler, mise can install arbitrary Go modules directly via the Go backend in src/backend/go.rs. This allows you to version-lock CLI tools built with Go without manual go install commands.

Module Resolution Process

The backend resolves module versions through the Go proxy protocol, falling back to go list -m -versions when necessary【src/plugins/core/go.rs†L58-L89】. It then executes installations using go install with support for build constraints.

Build Tag Support

You can pass environment variables and build tags during installation through the install_env and tags options【src/backend/go.rs†L140-L176】. This is essential for packages with conditional compilation or external dependencies.

Practical Installation Commands

Install and manage Go versions using the mise use command:


# Install latest Go 1.21.x and set as global default

mise use -g go@1.21

# Install specific version using prefix matching

mise use -g go@prefix:1.20

# Install a Go-based CLI tool directly

mise use -g go:github.com/DarthSim/hivemind

# Install with specific build tags

mise use -g go:github.com/golang-migrate/migrate/v4/cmd/migrate tags=postgres

List available versions before installing:


# List all Go runtime versions

mise ls-remote go

# List versions for a specific Go module

mise ls-remote go:github.com/DarthSim/hivemind

Configuring Go in mise.toml

Pin versions declaratively in your project configuration:

[tools]

# Pin specific Go version

go = "1.22.0"

# Pin Go module with pseudo-version

"go:github.com/grafana/oats" = "v0.7.1-0.20260703092802-96201f1b8136"

# Configure install environment variables

"go:github.com/grafana/oats" = { version = "v0.7.1-0.20260703092802-96201f1b8136",
                                 install_env = { GOPROXY = "direct", 
                                                 GONOSUMDB = "github.com/grafana/oats" } }

Summary

  • mise manages Go through two distinct backends: the core plugin for the toolchain (src/plugins/core/go.rs) and the Go backend for packages (src/backend/go.rs).
  • Automatic environment setup configures GOROOT, GOPATH, and GOBIN when activating Go versions.
  • Direct module installation treats Go packages as version-locked tools, supporting build tags and custom proxy settings.
  • Flexible version specification supports exact versions, prefixes, and pseudo-versions for both the compiler and individual modules.

Frequently Asked Questions

Can mise install specific patch versions of Go?

Yes, you can install exact versions like go@1.21.5 or use prefix matching to get the latest patch release within a minor version using go@prefix:1.21. The version resolution logic in src/plugins/core/go.rs filters available tags from the official Go repository to match your specification.

How does mise handle private Go modules?

The Go backend in src/backend/go.rs respects standard Go environment variables. Configure GOPROXY, GONOSUMDB, and other authentication settings through the install_env option in your mise.toml or via environment variables before running mise install.

What is the difference between go: and go@ in mise commands?

go@ refers to the Go compiler toolchain itself (e.g., go@1.22), while go: prefixes a module path for installing specific Go packages (e.g., go:github.com/user/tool). The former uses the core plugin, while the latter uses the Go backend for module installation.

Does mise support cross-compilation when installing Go tools?

While mise handles the installation of Go packages via go install, it respects the GOOS, GOARCH, and build tag settings you provide through install_env. For pure cross-compilation workflows, install the desired Go version first, then use standard Go build commands within your project directory.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →