mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-01 19:33:03 +00:00
17 lines
471 B
Bash
Executable File
17 lines
471 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" or .os == "freebsd")) | (.os + "-" + .arch + " = \"" + .sha256 + "\";")'
|