go: print-hashes script
- convert to nix-shell - shellcheck / shfmt fixes
This commit is contained in:
parent
f71b7b3dc5
commit
9d10f94380
@ -1,15 +1,16 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env nix-shell
|
||||||
|
#! nix-shell -i bash -p curl jq
|
||||||
|
# shellcheck shell=bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
BASEURL=https://go.dev/dl/
|
BASEURL=https://go.dev/dl/
|
||||||
VERSION=${1:-}
|
VERSION=${1:-}
|
||||||
|
|
||||||
if [[ -z $VERSION ]]
|
if [[ -z ${VERSION} ]]; then
|
||||||
then
|
echo "No version supplied"
|
||||||
echo "No version supplied"
|
exit 1
|
||||||
exit -1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
curl -s "${BASEURL}?mode=json&include=all" | \
|
curl -s "${BASEURL}?mode=json&include=all" |
|
||||||
jq '.[] | select(.version == "go'${VERSION}'")' | \
|
jq '.[] | select(.version == "go'"${VERSION}"'")' |
|
||||||
jq -r '.files[] | select(.kind == "archive" and (.os == "linux" or .os == "darwin")) | (.os + "-" + .arch + " = \"" + .sha256 + "\";")'
|
jq -r '.files[] | select(.kind == "archive" and (.os == "linux" or .os == "darwin")) | (.os + "-" + .arch + " = \"" + .sha256 + "\";")'
|
||||||
|
Loading…
Reference in New Issue
Block a user