summaryrefslogtreecommitdiff
path: root/go/install_go.sh
blob: 79264b7eb606fb3f5193bed227cacd0de5a9130f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash

GO_VERSION=go1.12.7.linux-amd64

if [[ $(ls -A ${GO_VERSION}.tar.gz) ]]
then
    echo "reusing downloaded golang bundle"
else
    echo "installing go lang bundle ${GO_VERSION}.tar.gz"
    curl -o $GO_VERSION.tar.gz https://dl.google.com/go/$GO_VERSION.tar.gz
fi

if [[ -d ./golang ]]
then
    if [[ $(ls -A ./golang/*) ]]
    then
        rm -r ./golang/*
    fi
else
    mkdir ./golang
fi
tar -C ./golang -xzf $GO_VERSION.tar.gz