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

34 lines
1.1 KiB
YAML

parameters:
target_directory:
type: string
default: /usr/local
steps:
- run:
name: Install golang
command: |
set -x
echo installing golang ${GOLANG_VERSION}
case "${OSTYPE}" in
linux*) os="linux" ;;
darwin*) os="darwin" ;;
msys*) os="windows" ;;
*) echo "unknown os: ${OSTYPE}"; exit 1 ;;
esac
if [[ "${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}.${os}-amd64.tar.gz
sudo tar -C << parameters.target_directory >> -xzf /tmp/golang.tar.gz
rm -rf /tmp/golang.tar.gz
else
rm -rf << parameters.target_directory >>/go
mkdir -p <<parameters.target_directory >>
curl -SL --fail -o /tmp/go.zip https://dl.google.com/go/go${GOLANG_VERSION}.windows-amd64.zip
unzip -q -o /tmp/go.zip -d << parameters.target_directory >>
rm -rf /tmp/go.zip
fi