tools: add patch version check to prepare-source.sh

Use endoflife.date to check for newer versions of the minor Go version
we're using and print a notice.
This commit is contained in:
Achilleas Koutsou 2025-02-07 11:27:00 +01:00
parent 231ee2896c
commit aac74da605

View file

@ -1,9 +1,20 @@
#!/bin/sh
set -eux
set -eu
# Pin Go and toolbox versions at a reasonable version
go get go@1.22.6 toolchain@1.22.6
GO_MINOR_VERSION="1.22"
GO_VERSION="${GO_MINOR_VERSION}.6"
# Check latest Go version for the minor we're using
LATEST=$(curl -s https://endoflife.date/api/go/"${GO_MINOR_VERSION}".json | jq -r .latest)
if test "$LATEST" != "$GO_VERSION"; then
echo "NOTE: A new minor release is available (${LATEST}), consider bumping the project version (${GO_VERSION})"
fi
set -x
# Pin Go and toolbox versions
go get "go@${GO_VERSION}" "toolchain@${GO_VERSION}"
# Update go.mod and go.sum:
go mod tidy