Adding upstream version 1.34.4.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
e393c3af3f
commit
4978089aab
4963 changed files with 677545 additions and 0 deletions
53
scripts/installgo_mac.sh
Normal file
53
scripts/installgo_mac.sh
Normal file
|
@ -0,0 +1,53 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -eux
|
||||
|
||||
ARCH=$(uname -m)
|
||||
GO_VERSION="1.24.3"
|
||||
GO_VERSION_SHA_arm64="64a3fa22142f627e78fac3018ce3d4aeace68b743eff0afda8aae0411df5e4fb" # from https://go.dev/dl
|
||||
GO_VERSION_SHA_amd64="13e6fe3fcf65689d77d40e633de1e31c6febbdbcb846eb05fc2434ed2213e92b" # from https://go.dev/dl
|
||||
|
||||
if [ "$ARCH" = 'arm64' ]; then
|
||||
GO_ARCH="darwin-arm64"
|
||||
GO_VERSION_SHA=${GO_VERSION_SHA_arm64}
|
||||
elif [ "$ARCH" = 'x86_64' ]; then
|
||||
GO_ARCH="darwin-amd64"
|
||||
GO_VERSION_SHA=${GO_VERSION_SHA_amd64}
|
||||
fi
|
||||
|
||||
# This path is cacheable. (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.)
|
||||
setup_go () {
|
||||
echo "installing go"
|
||||
curl -L "https://go.dev/dl/go${GO_VERSION}.${GO_ARCH}.tar.gz" --output "go${GO_VERSION}.${GO_ARCH}.tar.gz"
|
||||
if ! echo "${GO_VERSION_SHA} go${GO_VERSION}.${GO_ARCH}.tar.gz" | shasum --algorithm 256 --check -; then
|
||||
echo "Checksum failed" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sudo rm -rf "${path}/go"
|
||||
sudo tar -C "$path" -xzf "go${GO_VERSION}.${GO_ARCH}.tar.gz"
|
||||
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
|
||||
echo "Go is already installed"
|
||||
cd
|
||||
v=$(go version | { read -r _ _ v _; echo "${v#go}"; })
|
||||
echo "$v is installed, required version is ${GO_VERSION}"
|
||||
if [ "$v" != ${GO_VERSION} ]; then
|
||||
setup_go
|
||||
fi
|
||||
else
|
||||
setup_go
|
||||
fi
|
||||
|
||||
echo "$PATH"
|
||||
command -v go
|
||||
go version
|
Loading…
Add table
Add a link
Reference in a new issue