open-nomad/.circleci/config/commands/install-golang.yml

33 lines
1 KiB
YAML
Raw Normal View History

parameters:
target_directory:
type: string
default: /usr/local
2020-05-04 23:02:15 +00:00
os:
type: string
default: linux
steps:
- run:
2020-05-06 00:02:15 +00:00
name: Install golang
command: |
set -x
2020-05-04 23:02:15 +00:00
echo installing golang ${GOLANG_VERSION}
if [[ << parameters.os >> != "windows" ]]
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
fi