From 73639470d1ae975c5485e7f09783ac2d238477de Mon Sep 17 00:00:00 2001 From: Saketh Kalaga <51327242+renormalize@users.noreply.github.com> Date: Tue, 19 Nov 2024 23:43:04 +0530 Subject: [PATCH] Enhance the `check` make target to ensure the Go version adheres to `x.y.0`. (#930) --- hack/check.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/hack/check.sh b/hack/check.sh index d7b550116..ca2bda9c6 100755 --- a/hack/check.sh +++ b/hack/check.sh @@ -34,4 +34,15 @@ if [[ "$unformatted_files" ]]; then exit 1 fi -echo "All checks successful" \ No newline at end of file +echo "Checking Go version" +GOVERSION=$(go list -f {{.GoVersion}} -m) +if [[ $GOVERSION =~ ^[0-9]+\.[0-9]+\.0$ ]]; then + # Go version is valid, adheres to x.y.0 version + exit 0 +else + echo "Go version is invalid, please adhere to x.y.0 version" + echo "See https://github.com/gardener/etcd-druid/pull/925" + exit 1 +fi + +echo "All checks successful"