2022-08-05 03:53:18 +00:00
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#! nix-shell -i bash -p curl jq
|
|
|
|
# shellcheck shell=bash
|
2021-02-15 20:52:43 +00:00
|
|
|
set -euo pipefail
|
|
|
|
|
2021-11-26 09:11:14 +00:00
|
|
|
BASEURL=https://go.dev/dl/
|
2021-02-15 20:52:43 +00:00
|
|
|
VERSION=${1:-}
|
|
|
|
|
2022-08-05 03:53:18 +00:00
|
|
|
if [[ -z ${VERSION} ]]; then
|
|
|
|
echo "No version supplied"
|
|
|
|
exit 1
|
2021-02-15 20:52:43 +00:00
|
|
|
fi
|
|
|
|
|
2022-08-05 03:53:18 +00:00
|
|
|
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 + "\";")'
|