Skip to content

Go

mise can be used to install and manage multiple versions of go on the same system.

The following are instructions for using the go mise core plugin. This is used when there isn't a git plugin installed named "go". If you want to use asdf-golang then use mise plugins install go GIT_URL.

The code for this is inside the mise repository at ./src/plugins/core/go.rs.

Usage

The following installs the latest version of go-1.21.x (if some version of 1.21.x is not already installed) and makes it the global default:

sh
mise use -g go@1.21

Minor go versions 1.20 and below require specifying prefix before the version number because the first version of each series was released without a .0 suffix, making 1.20 an exact version match:

sh
mise use -g go@prefix:1.20

.go-version file support

mise uses a mise.toml or .tool-versions file for auto-switching between software versions. However, it can also read go-specific version files named .go-version.

See idiomatic version files

Default packages

mise can automatically install a default set of packages right after installing a new go version. To enable this feature, provide a $HOME/.default-go-packages file that lists one packages per line, for example:

text
github.com/daixiang0/gci # allows comments
github.com/jesseduffield/lazygit

Settings

go.default_packages_file

  • Type: string
  • Env: MISE_GO_DEFAULT_PACKAGES_FILE
  • Default: ~/.default-go-packages

Path to a file containing default go packages to install when installing go.

go.download_mirror

  • Type: string
  • Env: MISE_GO_DOWNLOAD_MIRROR
  • Default: https://dl.google.com/go

Mirror to download go sdk tarballs from.

go.repo

  • Type: string
  • Env: MISE_GO_REPO
  • Default: https://github.com/golang/go

URL to fetch go from.

go.set_gobin

  • Type: boolean(optional)
  • Env: MISE_GO_SET_GOBIN
  • Default: None

Defaults to ~/.local/share/mise/installs/go/.../bin. Set to true to override GOBIN if previously set. Set to false to not set GOBIN (default is ${GOPATH:-$HOME/go}/bin).

go.set_gopathdeprecated

  • Type: boolean
  • Env: MISE_GO_SET_GOPATH
  • Default: false
  • Deprecated: Use env._go.set_goroot instead.

[deprecated] Set to true to set GOPATH=~/.local/share/mise/installs/go/.../packages.

go.set_goroot

  • Type: boolean
  • Env: MISE_GO_SET_GOROOT
  • Default: true

Sets GOROOT=~/.local/share/mise/installs/go/.../.

go.skip_checksum

  • Type: boolean
  • Env: MISE_GO_SKIP_CHECKSUM
  • Default: false

Set to true to skip checksum verification when downloading go sdk tarballs.

Licensed under the MIT License. Maintained by @jdx and friends.