open-nomad/.circleci/config/commands/install-golang.yml
2020-05-15 10:15:37 -04:00

33 lines
1 KiB
YAML

parameters:
target_directory:
type: string
default: /usr/local
os:
type: string
default: linux
steps:
- run:
name: Install golang
command: |
set -x
echo installing golang ${GOLANG_VERSION}
if [[ << parameters.os >> != "windows" ]]
then
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