From d9cbdede414d2e37b5ae0b5297026b01f41d8b53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Budai?= Date: Wed, 22 Apr 2020 14:40:42 +0200 Subject: [PATCH] tools/prepare-source: use a well-defined go version go mod works differently in go 1.12 and go 1.13. When someone uses the prepare-source tool with go >= 1.13, the ci complains because it uses go 1.12. This commit changes the script to use a well-defined go version. --- tools/prepare-source.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tools/prepare-source.sh b/tools/prepare-source.sh index f77218b57..b7a8c1550 100755 --- a/tools/prepare-source.sh +++ b/tools/prepare-source.sh @@ -2,6 +2,15 @@ set -eux -go fmt ./... -go mod tidy -go mod vendor +GO_VERSION=1.12.17 +GO_BINARY=$(go env GOPATH)/bin/go$GO_VERSION + +# this is the official way to get a different version of golang +# see https://golang.org/doc/install#extra_versions +go get golang.org/dl/go$GO_VERSION +$GO_BINARY download + +# prepare the sources +$GO_BINARY fmt ./... +$GO_BINARY mod tidy +$GO_BINARY mod vendor