Skip to content
update-golang is a script to easily fetch and install new Golang releases with minimum system intrusion
Branch: master
Clone or download
udhos Version up.
Latest commit 8ca9935 Sep 17, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.travis.yml Remove apt operation from travis. Jun 13, 2018
LICENSE Initial commit Apr 10, 2017 Remove broken asciinema. Mar 18, 2019
pre-commit Update shebang to /usr/bin/env $shell May 3, 2019 Update shebang to /usr/bin/env $shell May 3, 2019 Update default version. May 8, 2019 Version up. Sep 17, 2019 Version up. Sep 17, 2019

license Travis Build Status


update-golang is a script to easily fetch and install new Golang releases with minimum system intrusion.

Table of Contents

Created by gh-md-toc

How it works

The script is based on official installation instructions from

This is the default behavior:

1. Search for the latest binary release in

2. The script uses local system OS and ARCH to download the correct binary release. It is not harmful to run the script multiple times. Downloaded releases are kept as cache under '/usr/local'. You can erase them manually.

By default, the script only detects actual releases (not beta releases, not release candidates). However one can force any specific non-final release:

$ # force specific release candidate
$ sudo RELEASE=1.11rc1 ./

3. The release is installed at '/usr/local/go'.

4. The path '/usr/local/go/bin' is added to PATH using '/etc/profile.d/'.

5. Only if needed, GOROOT is properly setup, also using '/etc/profile.d/'.

The script DOES NOT ever modify the GOPATH variable.

You can customize the behavior by setting environment variables (see Customization below).


git clone
cd update-golang
sudo ./


Before running the script, make sure you have an untampered copy by verifying the SHA256 checksum.

$ wget -qO hash.txt
$ sha256sum -c hash.txt OK


You can use the 'remove' option to undo work:

$ sudo ./ remove


Sample session:

lab@ubu1:~$ go
The program 'go' can be found in the following packages:
 * golang-go
 * gccgo-go
Try: sudo apt install <selected package>
lab@ubu1:~$ git clone
Cloning into 'update-golang'...
remote: Counting objects: 481, done.
remote: Compressing objects: 100% (11/11), done.
remote: Total 481 (delta 4), reused 9 (delta 2), pack-reused 468
Receiving objects: 100% (481/481), 70.22 KiB | 125.00 KiB/s, done.
Resolving deltas: 100% (248/248), done.
lab@ubu1:~$ cd update-golang
lab@ubu1:~/update-golang$ sudo ./ version 0.15 find_latest: found last release: 1.10.2 user: uid=0(root) gid=0(root) groups=0(root) RELEASE_LIST= SOURCE= DESTINATION=/usr/local RELEASE=1.10.2 OS=linux ARCH_PROBE=uname -m ARCH=amd64 PROFILED=/etc/profile.d/ CACHE=/usr/local GOPATH= DEBUG= will install golang go1.10.2.linux-amd64 as: /usr/local/go is remote no need to download - file cached: /usr/local/go1.10.2.linux-amd64.tar.gz remove_old_link: not found symlink for old install untar: tar -x -f /usr/local/go1.10.2.linux-amd64.tar.gz path: removing old settings from: /etc/profile.d/ path: issuing new /usr/local/go/bin to /etc/profile.d/ path: issuing /home/lab/go/bin to /etc/profile.d/ golang go1.10.2.linux-amd64 installed at: /usr/local/go testing: /usr/local/go/bin/go version go version go1.10.2 linux/amd64 /usr/local/go/bin/go version: SUCCESS testing: /usr/local/go/bin/go run /tmp/hello-tmpv1bX1rQN.go hello, world /usr/local/go/bin/go run /tmp/hello-tmpv1bX1rQN.go: SUCCESS cleanup: /tmp/tmp.tcNY25eXNl


These environment variables are available for customization:

RELEASE_LIST= ;# search for new releases from this url
SOURCE=           ;# download source location
DESTINATION=/usr/local                                 ;# install destination
RELEASE=1.8.3                                          ;# force golang release
OS=linux                                               ;# force os
ARCH_PROBE='uname -m'                                  ;# force arch detection command
ARCH=amd64                                             ;# force arch
PROFILED=/etc/profile.d/                 ;# update PATH, optionally set GOROOT
CACHE=/usr/local                                       ;# cache downloads in this dir
GOPATH=                                                ;# use this GOPATH
DEBUG=                                                 ;# set to enable debug


$ sudo RELEASE=1.9beta1 ./

Per-user Install

Default behavior is to install Golang globally for all system users.

However you can use the environment variables to point locations to your per-user home directory.

The per-user installation does not need root (sudo) privileges.


This example will install Golang under ~/golang for current user only.

$ mkdir ~/golang
$ DESTINATION=~/golang PROFILED=~/.profile ./


You can’t perform that action at this time.