2021-02-22 21:28:39 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
BASEURL=https://go.dev/dl/
|
2021-02-22 21:28:39 +00:00
|
|
|
VERSION=${1:-}
|
|
|
|
|
|
|
|
if [[ -z $VERSION ]]
|
|
|
|
then
|
|
|
|
echo "No version supplied"
|
|
|
|
exit -1
|
|
|
|
fi
|
|
|
|
|
|
|
|
curl -s "${BASEURL}?mode=json&include=all" | \
|
|
|
|
jq '.[] | select(.version == "go'${VERSION}'")' | \
|
|
|
|
jq -r '.files[] | select(.kind == "archive" and (.os == "linux" or .os == "darwin")) | (.os + "-" + .arch + " = \"" + .sha256 + "\";")'
|