Fix Mac script to install go (#9345)

Co-authored-by: reimda <reimda@users.noreply.github.com>
This commit is contained in:
Sebastian Spaink 2021-06-10 11:12:14 -05:00 committed by GitHub
parent 298670ae18
commit 62715d158b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View File

@ -1,7 +1,11 @@
#!/bin/bash
# To prevent the tests/builds to run for only a doc change, this script checks what files have changed in a pull request.
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
echo $BRANCH
if [[ "$BRANCH" != "master" ]]; then
git diff master --name-only --no-color | egrep -e "^(\.circleci\/.*)|(.*\.(go|mod|sum))|Makefile$" || circleci step halt;
if [[ "$BRANCH" != "master" ]] && [[ "$BRANCH" != release* ]]; then # This should never skip for master and release branches
# Ask git for all the differences between this branch and master
# Then use grep to look for changes in the .circleci/ directory, anything named *.go or *.mod or *.sum or *.sh or Makefile
# If no match is found, then circleci step halt will stop the CI job but mark it successful
git diff master --name-only --no-color | egrep -e "^(\.circleci\/.*)$|^(.*\.(go|mod|sum|sh))$|^Makefile$" || circleci step halt;
fi

View File

@ -3,8 +3,8 @@
set -eux
GO_ARCH="darwin-amd64"
GO_VERSION="1.16.2"
GO_VERSION_SHA="c98cde81517c5daf427f3071412f39d5bc58f6120e90a0d94cc51480fa04dbc1" # from https://golang.org/dl
GO_VERSION="1.16.5"
GO_VERSION_SHA="be761716d5bfc958a5367440f68ba6563509da2f539ad1e1864bd42fe553f277" # from https://golang.org/dl
# This path is cachable. (Saving in /usr/local/ would cause issues restoring the cache.)
path="/usr/local/Cellar"
@ -13,8 +13,8 @@ path="/usr/local/Cellar"
# it is slow to update and we can't pull specific minor versions.)
setup_go () {
echo "installing go"
curl -OL https://golang.org/dl/go${GO_VERSION}.${GO_ARCH}.tar.gz --output go${GO_VERSION}.${GO_ARCH}.tar.gz
echo "${GO_SHA} go${GO_VERSION}.${GO_ARCH}.tar.gz" | sha256sum --check
curl -L https://golang.org/dl/go${GO_VERSION}.${GO_ARCH}.tar.gz --output go${GO_VERSION}.${GO_ARCH}.tar.gz
echo "${GO_VERSION_SHA} go${GO_VERSION}.${GO_ARCH}.tar.gz" | shasum -a 256 --check
sudo rm -rf ${path}/go
sudo tar -C $path -xzf go${GO_VERSION}.${GO_ARCH}.tar.gz
ln -sf ${path}/go/bin/go /usr/local/bin/go