depot/third_party/nixpkgs/pkgs/development/compilers/go/print-hashes.sh
Default email 02cf88bb76 Project import generated by Copybara.
GitOrigin-RevId: c4a0efdd5a728e20791b8d8d2f26f90ac228ee8d
2022-08-12 15:06:08 +03:00

16 lines
451 B
Bash
Executable file

#!/usr/bin/env nix-shell
#! nix-shell -i bash -p curl jq
# shellcheck shell=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 + "\";")'