fix gimme go version noise

This commit is contained in:
Benjamin Elder
2020-08-06 15:33:44 -07:00
parent 93f7aab9ad
commit 83d19a4128

View File

@@ -19,13 +19,21 @@
# read go-version file unless GO_VERSION is set
GO_VERSION="${GO_VERSION:-"$(cat .go-version)"}"
# we don't actually care where the .env files are
# however, GIMME_SILENT_ENV doesn't trigger re-generating a .env if it
# already exists and isn't "silent" (no `go version` command in it)
# so we fix that by changing where the .env is written, ensuring ours
# is generated from this repo and silent.
export GIMME_ENV_PREFIX=./bin/.gimme/
export GIMME_SILENT_ENV=y
# only setup go if we haven't set FORCE_HOST_GO, or `go version` doesn't match
# go version output looks like:
# go version go1.14.5 darwin/amd64
if ! ([ -n "${FORCE_HOST_GO:-}" ] || \
(command -v go >/dev/null && [ "$(go version | cut -d' ' -f3)" = "go${GO_VERSION}" ])); then
# eval because the output of this is shell to set PATH etc.
eval "$(hack/third_party/gimme/gimme "${GO_VERSION}" 2>/dev/null)"
eval "$(hack/third_party/gimme/gimme "${GO_VERSION}")"
fi
# force go modules