From 9af3d940156edc3ab3363768196a249f9f1d8e20 Mon Sep 17 00:00:00 2001 From: "[SpLaT]" Date: Sun, 13 Oct 2019 16:53:26 +1100 Subject: [PATCH] Refactor Golang install script * This updates the script to install the latest version of Golang without having to manually lookup the latest version and update the script * Requires curl to already be installed * This should cause no side effects unless Golang makes a breaking change to their query or endpoint which returns the latest version --- go-setup.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/go-setup.sh b/go-setup.sh index b18d356..ac89906 100755 --- a/go-setup.sh +++ b/go-setup.sh @@ -1,15 +1,14 @@ #!/bin/bash -# Dirty dirty dirty -VERSION="1.12.7" +LATEST=$(curl https://golang.org/VERSION\?m\=text) source .bashrc -wget https://storage.googleapis.com/golang/go$VERSION.linux-amd64.tar.gz -tar xvfz go$VERSION.linux-amd64.tar.gz +wget https://storage.googleapis.com/golang/$LATEST.linux-amd64.tar.gz +tar xvfz $LATEST.linux-amd64.tar.gz sudo rm -rf /usr/local/go sudo mv go /usr/local/ go get golang.org/x/tools/cmd/goimports go get github.com/nsf/gocode -rm go$VERSION.linux-amd64.tar.gz +rm $LATEST.linux-amd64.tar.gz