原文地址 github.com
Elegant Go installer. Contribute to owenthereal/goup development by creating an account on GitHub.
goup
(pronounced Go Up) is an elegant Go version
manager.
It is notorious that an operating system's package manager takes time to update Go to the latest version, particularly on Linux distros. At the time of this writing in October 2020, Fedora 32's Go version from dnf is 1.14.9, while the latest Go version is 1.15.2.
There are a bunch of solutions to install Go or manage Go versions
outside of a package manager: golang/dl, getgo,
gvm, goenv, to name a few. All of
them either do not work well on all Linux distros (I ran into errors
with gvm
and goenv
on Fedora) or do not
provide the developer experience that I like (golang/dl
requires a Go compiler to pre-exist; getgo
can only install
the latest Go)
I want a Go version manager that:
- Has a minimum prerequisite to install, e.g., does not need a Go compiler to pre-exist.
- Is installed with a one-liner.
- Runs well on all operating systems (at least runs well on *uix as a start).
- Installs any version of Go (any version from golang.org/dl or tip) and switches to it.
- Does not inject magic into your shell.
- Is written in Go.
goup
is an attempt to fulfill the above features and is
heavily inspired by Rustup, golang/dl and getgo.
Installation
One-liner
1 | curl -sSf https://raw.githubusercontent.com/owenthereal/goup/master/install.sh | sh |
Install by skipping the confirmation prompt, e.g., for automation:
1 | curl -sSf https://raw.githubusercontent.com/owenthereal/goup/master/install.sh | sh -s -- '--skip-prompt' |
Manual
If you want to install goup manually, there are the steps:
- Download the latest
goup
from https://github.com/owenthereal/goup/releases - Drop the
goup
executable to yourPATH
and make it executable:mv GOUP_BIN /usr/local/bin/goup && chmod +x /usr/local/bin/goup
(为了和nvm命名统一, windows平台可以改名为gvm.exe, 并加入环境变量) - Add the Go bin directory to your shell startup script:
echo 'export PATH="$HOME/.go/current/bin:$PATH"' >> ~/.bashrc
(windows平台需要把.go/current/bin路径加入环境变量)
goup Quick Start
1 | $ goup install |
How it works
install.sh
downloads the latest Goup release for your platform and appends Goup's bin directory ($HOME/.go/bin
) & Go's bin directory ($HOME/.go/current/bin
) to your PATH environment variable.goup
switches to selected Go version.goup set
switches to selected Go version.goup install
downloads specified version of Go to$HOME/.go/VERSION
and symlinks it to$HOME/.go/current
.goup ls
list all installed Go version located at$HOME/.go/current
.goup remove
removes the specified Go version.goup search
lists all available Go versions from https://golang.org/dl.goup upgrade
upgrades goup.
Backlinks:
- goup- Elegant Go installer