drone-pre-commit/scripts/add_golang.sh
2023-10-26 14:26:46 -07:00

22 lines
411 B
Bash
Executable File

#! /bin/bash
set -ex
VERSION=1.21.3
ARCH=amd64
SHASUM=979694c2c25c735755bf26f4f45e19e64e4811d661dd07b8c010f7a8e18adfca
FILENAME="go${VERSION}.linux-${ARCH}.tar.gz"
GOURL="https://go.dev/dl/${FILENAME}"
wget --quiet "$GOURL"
# Check sum
echo "$SHASUM ./$FILENAME" > "${FILENAME}.sum"
shasum -c "./${FILENAME}.sum"
# Install
tar -C /usr/local -xzf "./$FILENAME"
# Clean up
rm "$FILENAME" "${FILENAME}.sum"