Last active
February 8, 2018 21:43
-
-
Save snadrus/02f7875ce6291a7b39e8c5abced5d9c2 to your computer and use it in GitHub Desktop.
This is an easy way to make sure your Golang builds are always using the latest stable (linux-amd64) compiler in one line of BASH.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bash: | |
curl -Ls golang.org/dl | grep -ohm1 htt[^\"]*linux-amd64.tar.gz | |
Returns just the line of the latest stable linux-amd64 build, like: | |
https://redirector.gvt1.com/edgedl/go/go1.9.2.linux-amd64.tar.gz | |
Make a ./go/ with the latest compiler ($GOROOT): | |
# Get the latest stable GoLang. | |
cd $GOROOT/.. | |
URL=$(curl -s https://golang.org/dl/ | grep -oh -m1 "https[^\"]*\.linux-amd64.tar.gz") | |
LATESTDL=$(echo "$URL" | sed -e 's/.*\///') | |
if [ ! -f $LATESTDL ] ; then | |
curl -OJL $URL | |
tar -xzf $LATESTDL | |
# Makes a "go" folder | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment