2022-08-12 12:06:08 +00:00
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#! nix-shell -i bash -p curl jq
|
|
|
|
# shellcheck shell=bash
|
2021-02-22 21:28:39 +00:00
|
|
|
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:-}
|
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
if [[ -z ${VERSION} ]]; then
|
|
|
|
echo "No version supplied"
|
|
|
|
exit 1
|
2021-02-22 21:28:39 +00:00
|
|
|
fi
|
|
|
|
|
2022-08-12 12:06:08 +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 + "\";")'
|