explaingit

moovweb/gvm

11,606ShellAudience · developerComplexity · 2/5Setup · moderate

TLDR

A shell tool for installing and switching between multiple Go versions on one machine, with isolated package environments per project so dependencies don't conflict.

Mindmap

mindmap
  root((gvm))
    What it does
      Install Go versions
      Switch Go versions
      Manage package sets
    Setup
      curl installer
      Shell integration
    Use Cases
      Multi-version dev
      Project isolation
    Platforms
      Linux
      macOS
      FreeBSD
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Install Go 1.18 and Go 1.21 side-by-side and switch between them per project with a single command.

USE CASE 2

Create a named package set for each project so installed Go packages stay isolated and don't conflict.

USE CASE 3

Bootstrap a Go installation from source on a machine that has no existing Go binary.

Tech stack

ShellBash

Getting it running

Difficulty · moderate Time to first run · 30min

Building Go 1.5+ from source requires an existing Go installation, the README explains the bootstrapping sequence to install Go 1.4 first.

In plain English

GVM is a command-line tool for installing and switching between multiple versions of Go on the same machine. It is written as a shell script and works on Linux, macOS, and FreeBSD. The main use case is letting developers keep several Go versions installed at once and switch between them on demand. You run a command like gvm install go1.20 to download and compile a specific version, then gvm use go1.20 to make that version active in the current shell. GVM sets the GOROOT and GOPATH environment variables automatically when you switch versions. A flag lets you set a default version so it activates in every new terminal session. The tool also manages package sets (pkgsets), which are isolated GOPATH environments. Each package set has its own set of installed Go packages, so you can keep dependencies for different projects separated. You can create, switch to, and delete named package sets without affecting other projects. One thing to know when installing newer Go versions from source: Go 1.5 and later removed the C compiler from their own build process and replaced it with a Go compiler, which means you need an existing working Go installation to compile them. The README explains the bootstrapping sequence, which typically involves installing Go 1.4 from a binary first, using it to build a newer version, and repeating as needed for the latest Go versions. Installation is a single curl command that downloads and runs the installer script. The command gvm implode removes gvm and all installed Go versions entirely. Mercurial and build tools like bison and gcc are required on the host machine before installing.

Copy-paste prompts

Prompt 1
Using GVM, show me the exact commands to install Go 1.21, set it as the default version, and create a new package set called myproject.
Prompt 2
I need to run a Go 1.18 project alongside a Go 1.21 project on the same machine with GVM. What commands switch versions and package sets between them?
Prompt 3
Walk me through the GVM bootstrapping sequence to install Go 1.22 from source on a fresh Linux machine with no existing Go installation.
Prompt 4
How do I completely remove GVM and all installed Go versions from my machine using the gvm implode command?
Open on GitHub → Explain another repo

← moovweb on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.