c0b962ecfa
* Go 1.17.2 -> 1.17.5 * Switching to cimg
34 lines
1.2 KiB
YAML
34 lines
1.2 KiB
YAML
---
|
|
description: >
|
|
Ensure the right version of Go is installed and set GOPATH to $HOME/go.
|
|
parameters:
|
|
GOPROXY:
|
|
description: >
|
|
Set GOPROXY. By default this is set to "off" meaning you have to have all modules pre-downloaded.
|
|
type: string
|
|
default: "off"
|
|
GOPRIVATE:
|
|
description: Set GOPRIVATE, defaults to github.com/hashicorp/*
|
|
type: string
|
|
default: github.com/hashicorp/*
|
|
steps:
|
|
- run:
|
|
working_directory: ~/
|
|
name: Setup Go
|
|
command: |
|
|
[ -n "$GO_VERSION" ] || { echo "You must set GO_VERSION"; exit 1; }
|
|
# Install Go
|
|
curl -sSLO "https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz"
|
|
sudo rm -rf /usr/local/go
|
|
sudo tar -C /usr/local -xzf "go${GO_VERSION}.linux-amd64.tar.gz"
|
|
rm -f "go${GO_VERSION}.linux-amd64.tar.gz"
|
|
GOPATH="/home/circleci/go"
|
|
mkdir $GOPATH 2>/dev/null || { sudo mkdir $GOPATH && sudo chmod 777 $GOPATH; }
|
|
echo "export GOPATH='$GOPATH'" >> "$BASH_ENV"
|
|
echo "export PATH='$PATH:$GOPATH/bin:/usr/local/go/bin'" >> "$BASH_ENV"
|
|
echo "export GOPROXY=<<parameters.GOPROXY>>" >> "$BASH_ENV"
|
|
echo "export GOPRIVATE=<<parameters.GOPRIVATE>>" >> "$BASH_ENV"
|
|
|
|
echo "$ go version"
|
|
go version
|