Skip to content

Golang Version Manager (gvm)

License

Notifications You must be signed in to change notification settings

jetsung/golang-install

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Golang

  • Support Linux / MacOS / FreeBSD

English | 简体中文


Golang Version Manager

Install

curl -fsL https://github.com/jetsung/golang-install/raw/main/gvm.sh | bash -s -- -i

# or
git clone https://github.com/jetsung/golang-install.git
cd golang-install
./gvm.sh -i

# source $HOME/.zshrc
# source $HOME/.bashrc

gvm version

Help

# gvm -h

gvm 1.0.4
Golang Version Manager

USAGE:
    gvm [OPTIONS] <SUBCOMMANDS>

OPTIONS:
    -h, --help
                Print help information

    -i, --install
                Install Golang Version Manager

    -u, --update
                Update Golang Version Manager

    -v, --version
                Print Gvm version information

SUBCOMMANDS:
  current               Print the current go version
  install [version]     Install a new go version
  list                  List all locally installed go versions
  list-remote <more>    List all remote go versions
  uninstall             Uninstall a Go version
  use [version]         Change Go version

Golang Install

The latest version of the golang is installed.

  • Support custom version
  • Support custom GOPATH

Notice

  • GOROOT: $HOME/.go
  • By default, the latest version of go version is installed, and the GOPATH directory is $HOME/go

Installation

Online

Default install

curl -fsL https://raw.githubusercontent.com/jetsung/golang-install/main/install.sh | bash

Custom version

  • MY_DIY_GO_VERSION is a custom golang version, such as: 1.12.8
  • MY_DIY_GO_PATH is a custom gopath, such as: /home/myhome/go
curl -fsL https://raw.githubusercontent.com/jetsung/golang-install/main/install.sh | bash -s -- -v MY_DIY_GO_VERSION -p MY_DIY_GO_PATH

Offline

Save the script as a file name install.sh

# default install
bash install.sh

# customize
bash install.sh -v 1.12.8 -p /home/myhome/go

When you add executable permissions, you can customize the version and gopath.

# add executable
chmod +x install.sh

# default install
./install.sh

# customize
./install.sh -v 1.12.8 -p /home/myhome/go

Usage
./install.sh -h

Go install

USAGE:
    install.sh [OPTIONS] <SUBCOMMANDS>

OPTIONS:
    -h, --help
                Print help information.

    -p, --path
                Set GOPATH. (default: $HOME/go)

    -r, --root
                Set GOROOT. (default: $HOME/.go)

    -v, --version
                Set golang version.

License

This project is licensed under the MIT license.

About

Golang Version Manager (gvm)

Resources

License

Stars

Watchers

Forks

Languages