2020-03-23 15:28:54 +00:00
|
|
|
parameters:
|
|
|
|
target_directory:
|
|
|
|
type: string
|
|
|
|
default: /usr/local
|
2020-05-04 23:02:15 +00:00
|
|
|
os:
|
|
|
|
type: string
|
|
|
|
default: linux
|
2019-11-20 16:11:28 +00:00
|
|
|
steps:
|
|
|
|
- run:
|
2020-05-06 00:02:15 +00:00
|
|
|
name: Install golang
|
2019-11-20 16:11:28 +00:00
|
|
|
command: |
|
|
|
|
set -x
|
2020-03-23 15:28:54 +00:00
|
|
|
|
2020-05-04 23:02:15 +00:00
|
|
|
echo installing golang ${GOLANG_VERSION}
|
|
|
|
|
|
|
|
if [[ << parameters.os >> != "windows" ]]
|
2020-03-23 15:28:54 +00:00
|
|
|
then
|
2020-05-04 23:02:15 +00:00
|
|
|
sudo rm -rf << parameters.target_directory >>/go
|
|
|
|
sudo mkdir -p << parameters.target_directory >>
|
|
|
|
curl -SL --fail -o /tmp/golang.tar.gz https://dl.google.com/go/go${GOLANG_VERSION}.<< parameters.os >>-amd64.tar.gz
|
|
|
|
sudo tar -C << parameters.target_directory >> -xzf /tmp/golang.tar.gz
|
|
|
|
rm -rf /tmp/golang.tar.gz
|
|
|
|
else
|
|
|
|
if [[ ! -d "c:\go" ]]
|
|
|
|
then
|
|
|
|
echo "Cache not found, doing a fresh install of go"
|
|
|
|
rm -rf << parameters.target_directory >>/go
|
|
|
|
mkdir -p <<parameters.target_directory >>
|
|
|
|
curl -SL --fail -o go.zip https://dl.google.com/go/go${GOLANG_VERSION}.<< parameters.os >>-amd64.zip
|
|
|
|
unzip -o go.zip -d "/c"
|
|
|
|
fi
|
2020-03-23 15:28:54 +00:00
|
|
|
fi
|