Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Allow for non x86 macs in Go install script #9982

Merged
merged 2 commits into from
Oct 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions scripts/installgo_mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@

set -eux

GO_ARCH="darwin-amd64"
ARCH=$(uname -m)
GO_VERSION="1.17.2"
GO_VERSION_SHA="7914497a302a132a465d33f5ee044ce05568bacdb390ab805cb75a3435a23f94" # from https://golang.org/dl
if [ "$ARCH" = 'arm64' ]; then
GO_ARCH="darwin-arm64"
GO_VERSION_SHA="ce8771bd3edfb5b28104084b56bbb532eeb47fbb7769c3e664c6223712c30904" # from https://golang.org/dl
elif [ "$ARCH" = 'x86_64' ]; then
GO_ARCH="darwin-amd64"
GO_VERSION_SHA="7914497a302a132a465d33f5ee044ce05568bacdb390ab805cb75a3435a23f94" # from https://golang.org/dl
fi

# This path is cachable. (Saving in /usr/local/ would cause issues restoring the cache.)
path="/usr/local/Cellar"
sudo mkdir -p ${path}

# Download Go and verify Go tarball. (Note: we aren't using brew because
# it is slow to update and we can't pull specific minor versions.)
Expand All @@ -21,8 +28,9 @@ setup_go () {

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
ln -sf ${path}/go/bin/gofmt /usr/local/bin/gofmt
sudo mkdir -p /usr/local/bin
sudo ln -sf ${path}/go/bin/go /usr/local/bin/go
sudo ln -sf ${path}/go/bin/gofmt /usr/local/bin/gofmt
}

if command -v go >/dev/null 2>&1; then
Expand Down