Home

Awesome

Goup

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:

goup is an attempt to fulfill the above features and is heavily inspired by Rustup, golang/dl and getgo.

Installation

One-liner

curl -sSf https://raw.githubusercontent.com/owenthereal/goup/master/install.sh | sh

Install by skipping the confirmation prompt, e.g., for automation:

curl -sSf https://raw.githubusercontent.com/owenthereal/goup/master/install.sh | sh -s -- '--skip-prompt'

With Go Toolchain

go install github.com/owenthereal/goup/cmd/goup@latest

Manual

If you want to install manually, there are the steps:

Quick Start

$ goup install
Downloaded   0.0% (    32768 / 121149509 bytes) ...
Downloaded  12.4% ( 15007632 / 121149509 bytes) ...
Downloaded  30.2% ( 36634352 / 121149509 bytes) ...
Downloaded  47.6% ( 57703440 / 121149509 bytes) ...
Downloaded  65.9% ( 79855008 / 121149509 bytes) ...
Downloaded  84.2% (101972672 / 121149509 bytes) ...
Downloaded 100.0% (121149509 / 121149509 bytes)
INFO[0030] Unpacking /home/owen/.go/go1.15.2/go1.15.2.linux-amd64.tar.gz ...
INFO[0043] Success: go1.15.2 downloaded in /home/owen/.go/go1.15.2
INFO[0043] Default Go is set to 'go1.15.2'
$ goup ls
go1.15.2
$ go env GOROOT
/home/owen/.go/go1.15.2
$ go version
go version go1.15.2 linux/amd64

$ goup install tip
Cloning into '/home/owen/.go/gotip'...
remote: Counting objects: 10041, done
remote: Finding sources: 100% (10041/10041)
remote: Total 10041 (delta 1347), reused 6538 (delta 1347)
Receiving objects: 100% (10041/10041), 23.83 MiB | 3.16 MiB/s, done.
Resolving deltas: 100% (1347/1347), done.
Updating files: 100% (9212/9212), done.
INFO[0078] Updating the go development tree...
From https://go.googlesource.com/go
 * branch            master     -> FETCH_HEAD
HEAD is now at 5d13781 cmd/cgo: add more architectures to size maps
Building Go cmd/dist using /home/owen/.go/go1.15.2. (go1.15.2 linux/amd64)
Building Go toolchain1 using /home/owen/.go/go1.15.2.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for linux/amd64.
---
Installed Go for linux/amd64 in /home/owen/.go/gotip
Installed commands in /home/owen/.go/gotip/bin
INFO[0297] Default Go is set to 'gotip'
$ goup ls
gotip
$ go env GOROOT
/home/owen/.go/gotip
$ go version
go version devel +5d13781 Thu Oct 8 00:28:09 2020 +0000 linux/amd64


$ GOUP_GO_HOST=golang.google.cn goup install # For Gophers in China, see https://github.com/owenthereal/goup/issues/2

How it works

License

Apache 2.0