make: allow using a development version of Go, with a warning (#2260)
This commit is contained in:
parent
e3cb4ab2c4
commit
18764eff0e
2 changed files with 15 additions and 4 deletions
3
Makefile
3
Makefile
|
@ -1,5 +1,8 @@
|
||||||
include mk/platform.mk
|
include mk/platform.mk
|
||||||
|
|
||||||
|
BUILD_REQUIRE_GO_MAJOR ?= 1
|
||||||
|
BUILD_REQUIRE_GO_MINOR ?= 20
|
||||||
|
|
||||||
BUILD_CODENAME ?= alphaga
|
BUILD_CODENAME ?= alphaga
|
||||||
|
|
||||||
CROWDSEC_FOLDER = ./cmd/crowdsec
|
CROWDSEC_FOLDER = ./cmd/crowdsec
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
|
|
||||||
BUILD_REQUIRE_GO_MAJOR ?= 1
|
|
||||||
BUILD_REQUIRE_GO_MINOR ?= 20
|
|
||||||
|
|
||||||
BUILD_GOVERSION = $(subst go,,$(shell go env GOVERSION))
|
BUILD_GOVERSION = $(subst go,,$(shell go env GOVERSION))
|
||||||
|
|
||||||
go_major_minor = $(subst ., ,$(BUILD_GOVERSION))
|
go_major_minor = $(subst ., ,$(BUILD_GOVERSION))
|
||||||
|
@ -10,8 +7,19 @@ GO_MINOR_VERSION = $(word 2, $(go_major_minor))
|
||||||
|
|
||||||
GO_VERSION_VALIDATION_ERR_MSG = Golang version ($(BUILD_GOVERSION)) is not supported, please use at least $(BUILD_REQUIRE_GO_MAJOR).$(BUILD_REQUIRE_GO_MINOR)
|
GO_VERSION_VALIDATION_ERR_MSG = Golang version ($(BUILD_GOVERSION)) is not supported, please use at least $(BUILD_REQUIRE_GO_MAJOR).$(BUILD_REQUIRE_GO_MINOR)
|
||||||
|
|
||||||
|
|
||||||
.PHONY: goversion
|
.PHONY: goversion
|
||||||
goversion:
|
goversion: $(if $(findstring devel,$(shell go env GOVERSION)),goversion_devel,goversion_check)
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: goversion_devel
|
||||||
|
goversion_devel:
|
||||||
|
$(warning WARNING: You are using a development version of Golang ($(BUILD_GOVERSION)) which is not supported. For production environments, use a stable version (at least $(BUILD_REQUIRE_GO_MAJOR).$(BUILD_REQUIRE_GO_MINOR)))
|
||||||
|
$(info )
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: goversion_check
|
||||||
|
goversion_check:
|
||||||
ifneq ($(OS), Windows_NT)
|
ifneq ($(OS), Windows_NT)
|
||||||
@if [ $(GO_MAJOR_VERSION) -gt $(BUILD_REQUIRE_GO_MAJOR) ]; then \
|
@if [ $(GO_MAJOR_VERSION) -gt $(BUILD_REQUIRE_GO_MAJOR) ]; then \
|
||||||
exit 0; \
|
exit 0; \
|
||||||
|
|
Loading…
Reference in a new issue