#!/usr/bin/env bash set -e GOLANG_VERSION=1.17.2 if [[ -z $1 ]]; then echo "architecture required: amd64, arm64, or arm" 1>&2 exit 1 else set -eux; if [[ $1 == "amd64" ]]; then URL="https://golang.org/dl/go${GOLANG_VERSION}.linux-$1.tar.gz" CHECKSUM="f242a9db6a0ad1846de7b6d94d507915d14062660616a61ef7c808a76e4f1676 *go.tgz" elif [[ $1 == "arm64" ]]; then URL="https://golang.org/dl/go${GOLANG_VERSION}.linux-$1.tar.gz" CHECKSUM="a5a43c9cdabdb9f371d56951b14290eba8ce2f9b0db48fb5fc657943984fd4fc *go.tgz" elif [[ $1 == "arm" ]]; then URL="https://golang.org/dl/go${GOLANG_VERSION}.linux-armv6l.tar.gz" CHECKSUM="04d16105008230a9763005be05606f7eb1c683a3dbf0fbfed4034b23889cb7f2 *go.tgz" else echo "unsupported architecture" 1>&2 exit 1 fi wget -O go.tgz $URL echo $CHECKSUM | sha256sum -c - rm -rf /usr/local/go tar -C /usr/local -xzf go.tgz rm go.tgz /usr/local/go/bin/go version fi