- 支持 Linux / MacOS / FreeBSD 等系统
English | 简体中文
- Golang Version Manager: gvm.sh
- Golang Install: install.sh
curl -fsL https://framagit.org/jetsung/golang-install/-/raw/main/gvm.sh | bash
# 或者
git clone https://framagit.org/jetsung/golang-install.git
cd golang-install
./gvm.sh -i
# source $HOME/.zshrc
# source $HOME/.bashrc
gvm version
# gvm -h
gvm 1.1.0
Golang Version Manager
Usage: gvm [OPTIONS] [COMMAND]
Commands:
use [VERSION|latest] Change Go version
install [VERSION|latest] Install a new go version
uninstall Uninstall a Go version
list List all locally installed go versions
remote <more> List all remote go versions
version Print the current go version
Options:
-i, --install
Install Golang Version Manager
-u, --update
Update Golang Version Manager
-h, --help
Print help information
-v, --version
Print Gvm version information
最新版 Go 语言一键安装脚本。
- 支持自定义版本
- 支持自定义GOPATH
注意
- GOROOT:
$HOME/.go
- 默认安装最新版本的 go version, GOPATH 目录为
$HOME/go
curl -fsL https://framagit.org/jetsung/golang-install/-/raw/main/install.sh | bash
- MY_DIY_GO_VERSION 是自定义版本号, 例如:
1.12.8
- MY_DIY_GO_PATH 是自定义版本号, 例如:
/home/myhome/go
curl -fsL https://framagit.org/jetsung/golang-install/-/raw/main/install.sh | bash -s -- -v MY_DIY_GO_VERSION -p MY_DIY_GO_PATH
保存脚本并且命名为 install.sh
# 默认配置
bash install.sh
# 自定义
bash install.sh -v 1.12.8 -p /home/myhome/go
脚本可执行权限,那么同时可以自定义 Go 版本和 GOPATH。
# 添加可执行权限
chmod +x install.sh
# 默认配置
./install.sh
# 自定义
./install.sh -v 1.12.8 -p /home/myhome/go
使用说明
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.
This project is licensed under the MIT license.