Skip to content

Commit 561f78f

Browse files
GODRIVER-3493 Download if unavailable
1 parent 6368688 commit 561f78f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

etc/compile_check_other.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
set -e # exit when any command fails
33
set -x # show all commands being run
44

5-
: ${GO_VERSION:="1.18"} # Default to 1.18 if GO_VERSION is unset or empty
6-
: ${GC:=go$GO_VERSION} # Use existing GC or default to "go$GO_VERSION"
5+
: ${GC:=go${GO_VERSION="1.18"}}
76

87
COMPILE_CHECK_DIR="internal/cmd/compilecheck"
98
ARCHITECTURES=("386" "arm" "arm64" "ppc64le" "s390x")
@@ -15,6 +14,16 @@ function compile_check {
1514
# Change the directory to the compilecheck test directory.
1615
pushd "${COMPILE_CHECK_DIR}" >/dev/null
1716

17+
# If a custom Go version is set using the GO_VERSION env var (e.g. "1.18"),
18+
# add the GOPATH bin directory to PATH and then install that Go version.
19+
if [ ! -z "$GO_VERSION" ]; then
20+
PATH=$(go env GOPATH)/bin:$PATH
21+
export PATH
22+
23+
go install golang.org/dl/go$GO_VERSION@latest
24+
${GC} download
25+
fi
26+
1827
${GC} version
1928
${GC} mod tidy
2029

0 commit comments

Comments
 (0)