nixpkgs/pkgs/development/compilers/go/print-hashes.sh
zowoq 38ee5f8707 go: update URLs
golang.org redirects to go.dev
2021-11-26 19:12:14 +10:00

16 lines
398 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
BASEURL=https://go.dev/dl/
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 + "\";")'