about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/go/print-hashes.sh
blob: f095b67c627bd6d46093291acabf069ab29e3540 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/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 + "\";")'