Skip to content

Commit e488002

Browse files
authored
Merge pull request #9214 from guggero/release-go-version-check
makefile+scripts: add Go version check to release command
2 parents b4ef22b + 7919b3f commit e488002

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ release-install:
162162
release: clean-mobile
163163
@$(call print, "Releasing lnd and lncli binaries.")
164164
$(VERSION_CHECK)
165-
./scripts/release.sh build-release "$(VERSION_TAG)" "$(BUILD_SYSTEM)" "$(RELEASE_TAGS)" "$(RELEASE_LDFLAGS)"
165+
./scripts/release.sh build-release "$(VERSION_TAG)" "$(BUILD_SYSTEM)" "$(RELEASE_TAGS)" "$(RELEASE_LDFLAGS)" "$(GO_VERSION)"
166166

167167
#? docker-release: Same as release but within a docker container to support reproducible builds on BSD/MacOS platforms
168168
docker-release:

scripts/release.sh

+13-1
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,23 @@ function check_tag_correct() {
129129

130130
# build_release builds the actual release binaries.
131131
# arguments: <version-tag> <build-system(s)> <build-tags> <ldflags>
132+
# <go-version>
132133
function build_release() {
133134
local tag=$1
134135
local sys=$2
135136
local buildtags=$3
136137
local ldflags=$4
138+
local goversion=$5
139+
140+
# Check if the active Go version matches the specified Go version.
141+
active_go_version=$(go version | awk '{print $3}' | sed 's/go//')
142+
if [ "$active_go_version" != "$goversion" ]; then
143+
echo "Error: active Go version ($active_go_version) does not match \
144+
required Go version ($goversion)."
145+
exit 1
146+
fi
147+
148+
echo "Building release for tag $tag with Go version $goversion"
137149

138150
green " - Packaging vendor"
139151
go mod vendor
@@ -202,7 +214,7 @@ function build_release() {
202214
function usage() {
203215
red "Usage: "
204216
red "release.sh check-tag <version-tag>"
205-
red "release.sh build-release <version-tag> <build-system(s)> <build-tags> <ldflags>"
217+
red "release.sh build-release <version-tag> <build-system(s)> <build-tags> <ldflags> <go-version>"
206218
}
207219

208220
# Whatever sub command is passed in, we need at least 2 arguments.

0 commit comments

Comments
 (0)