Skip to content

Commit 80ccbf4

Browse files
committed
Makefile: use macro to define the minimum required go version
1 parent 3efaf7a commit 80ccbf4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

Makefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ THOR_VERSION = $(shell cat cmd/thor/VERSION)
77
DISCO_VERSION = $(shell cat cmd/disco/VERSION)
88

99
PACKAGES = `go list ./... | grep -v '/vendor/'`
10-
10+
REQUIRED_GO_MAJOR = 1
11+
REQUIRED_GO_MINOR = 24
1112
MAJOR = $(shell go version | cut -d' ' -f3 | cut -b 3- | cut -d. -f1)
1213
MINOR = $(shell go version | cut -d' ' -f3 | cut -b 3- | cut -d. -f2)
1314
export GO111MODULE=on
@@ -32,12 +33,12 @@ dep:| go_version_check
3233
@go mod download
3334

3435
go_version_check:
35-
@if test $(MAJOR) -lt 1; then \
36-
echo "Go 1.24 or higher required"; \
36+
@if test $(MAJOR) -lt $(REQUIRED_GO_MAJOR); then \
37+
echo "Go $(REQUIRED_GO_MAJOR).$(REQUIRED_GO_MINOR) or higher required"; \
3738
exit 1; \
3839
else \
39-
if test $(MAJOR) -eq 1 -a $(MINOR) -lt 22; then \
40-
echo "Go 1.24 or higher required"; \
40+
if test $(MAJOR) -eq $(REQUIRED_GO_MAJOR) -a $(MINOR) -lt $(REQUIRED_GO_MINOR); then \
41+
echo "Go $(REQUIRED_GO_MAJOR).$(REQUIRED_GO_MINOR) or higher required"; \
4142
exit 1; \
4243
fi \
4344
fi

0 commit comments

Comments
 (0)