diff --git a/Makefile b/Makefile index 2806fe315..ba1768423 100644 --- a/Makefile +++ b/Makefile @@ -118,7 +118,7 @@ release-install: release: @$(call print, "Releasing tapd and tapcli binaries.") $(VERSION_CHECK) - ./scripts/release.sh build-release "$(VERSION_TAG)" "$(BUILD_SYSTEM)" "$(RELEASE_TAGS)" "$(RELEASE_LDFLAGS)" + ./scripts/release.sh build-release "$(VERSION_TAG)" "$(BUILD_SYSTEM)" "$(RELEASE_TAGS)" "$(RELEASE_LDFLAGS)" "$(GO_VERSION)" release-tag: @$(call print, "Adding release tag.") diff --git a/scripts/release.sh b/scripts/release.sh index 3d28a9542..74667ed3a 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -118,11 +118,23 @@ function check_tag_correct() { # build_release builds the actual release binaries. # arguments: +# function build_release() { local tag=$1 local sys=$2 local buildtags=$3 local ldflags=$4 + local goversion=$5 + + # Check if the active Go version matches the specified Go version. + active_go_version=$(go version | awk '{print $3}' | sed 's/go//') + if [ "$active_go_version" != "$goversion" ]; then + echo "Error: active Go version ($active_go_version) does not match \ +required Go version ($goversion)." + exit 1 + fi + + echo "Building release for tag $tag with Go version $goversion" green " - Packaging vendor" go mod vendor