GithubHelp home page GithubHelp logo

xvrzhao / gvm Goto Github PK

View Code? Open in Web Editor NEW
12.0 2.0 1.0 978 KB

GVM is a Go version manager written in Go language, it provides some useful commands like `install`, `list`, `switch` and `remove` to manage local installation of multiple Go versions.

License: MIT License

Go 100.00%
golang gotools go goversion goroot gopath gvm

gvm's Introduction

GVM

GitHub tag (latest SemVer) GitHub issues GitHub license

GVM is a Go version manager written in Go language, it provides some useful commands like install, list, switch and remove to manage local installation of multiple Go versions.

usage

GVM is just support for Unix-like system yet, and the working mechanism is very simple. GVM will create a gvm directory in /usr/local to host multiple versions of GOROOT, and create a symbol link named go in /usr/local referring to the specific version in gvm directory. So, you just need to add /usr/local/go/bin to $PATH environment variable to run go command, and use GVM to switch the reference of the symbol link.

Multiple versions of Go installed by GVM can share the same GOPATH compatibly, and this is also advocated by GVM.

Installation

There are two ways to install GVM.

Install by Go

If you have installed Go before, just execute the following command:

$ go install github.com/xvrzhao/gvm@latest

Note:

This will install the GVM binary into your $GOBIN (same as $GOPATH/bin) directory. If you have added $GOBIN to $PATH, you can use GVM commands directly. However, some subcommands (like switch, install, etc.) need to write files in /usr/local/, so please make sure you have the appropriate permissions. You can execute the GVM commands with root privilege, like sudo gvm [command].

But sometimes it may prompt sudo: gvm: command not found, that is, the root user cannot find GVM binary in his/her $PATH directories. Because sudo does not use shell login configurations (/etc/profile, $HOME/.bashrc, etc.) to initialize the $PATH environment variable, $GOBIN is not the part of $PATH. Therefore, when the current user is not root, you can use GVM with sudo $(which gvm) [command]. Or, thoroughly, install and use GVM under root user login.

Download the binary

Another way is downloading the binary file corresponding to your operating system in the Releases Page.

Commands

For examples:

# Install and switch to go1.16.3, mainland China require `--cn`.
$ sudo gvm install 1.16.3 --switch --cn 

# List all versions managed by GVM.
$ gvm list

# Remove go1.16.3.
$ gvm remove 1.16.3

# Switch to go1.17.
$ gvm switch 1.17

For all available commands and flags, see:

$ gvm help [subcommand]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.