My Go notes


Slowly migrating commonly used items and internal notes to this space…

Upgrade Go version (Mac)

Always be wary of things you find on the internet that use a combination of wget, tar and sudo.

Go downloads

# remove old version
sudo rm -rf /usr/local/go
# download a Go version, redirect output to stdout (quietly), pipe into tar and print version
wget -qO- https://dl.google.com/go/go1.5.2.darwin-amd64.tar.gz | sudo tar -C /usr/local -xz && go version
# go version go1.5.2 darwin/amd64

Building from source

# assuming an existing go version already exists (no need to bootstrap)..

mkdir ~/source && cd $_
git clone https://go.googlesource.com/go

# on subsequent runs, to pull latest changes locally
# git pull origin master

cd ./go/src
./make.bash

# set precedence, this will vary depending on your needs.
# $HOME/source/go/bin/go vs /usr/local/go/bin/go
# export PATH=$HOME/source/go/bin:$PATH

go version
# go version devel +5a720d229d Sat Aug 4 16:37:47 2018 +0000 darwin/amd64