diff --git a/Makefile b/Makefile index e818e4f98..d295ee068 100644 --- a/Makefile +++ b/Makefile @@ -43,9 +43,6 @@ CROWDSEC_BIN = crowdsec$(EXT) CSCLI_BIN = cscli$(EXT) BUILD_CMD = build -GOOS ?= $(shell go env GOOS) -GOARCH ?= $(shell go env GOARCH) - MINIMUM_SUPPORTED_GO_MAJOR_VERSION = 1 MINIMUM_SUPPORTED_GO_MINOR_VERSION = 17 GO_VERSION_VALIDATION_ERR_MSG = Golang version ($(BUILD_GOVERSION)) is not supported, please use at least $(MINIMUM_SUPPORTED_GO_MAJOR_VERSION).$(MINIMUM_SUPPORTED_GO_MINOR_VERSION) diff --git a/platform/unix_common.mk b/platform/unix_common.mk index 05fba2555..3ce3d97e0 100644 --- a/platform/unix_common.mk +++ b/platform/unix_common.mk @@ -4,10 +4,14 @@ CP=cp CPR=cp -r MKDIR=mkdir -p -GO_MAJOR_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1) -GO_MINOR_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f2) +# Go should not be required to run functional tests +GOOS ?= $(shell command -v go >/dev/null && go env GOOS) +GOARCH ?= $(shell command -v go >/dev/null && go env GOARCH) -BUILD_GOVERSION="$(shell go version | cut -d " " -f3 | sed -E 's/[go]+//g')" +GO_MAJOR_VERSION = $(shell command -v go >/dev/null && go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1) +GO_MINOR_VERSION = $(shell command -v go >/dev/null && go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f2) + +BUILD_GOVERSION="$(shell command -v go >/dev/null && go version | cut -d " " -f3 | sed -E 's/[go]+//g')" #Current versioning information from env BUILD_VERSION?="$(shell git describe --tags $$(git rev-list --tags --max-count=1))" @@ -15,4 +19,4 @@ BUILD_CODENAME="alphaga" BUILD_TIMESTAMP=$(shell date +%F"_"%T) BUILD_TAG?="$(shell git rev-parse HEAD)" DEFAULT_CONFIGDIR?=/etc/crowdsec -DEFAULT_DATADIR?=/var/lib/crowdsec/data \ No newline at end of file +DEFAULT_DATADIR?=/var/lib/crowdsec/data diff --git a/platform/windows.mk b/platform/windows.mk index 9cf6f7e8b..0370859b2 100644 --- a/platform/windows.mk +++ b/platform/windows.mk @@ -5,6 +5,9 @@ MAKE=make GOOS=windows PREFIX=$(shell $$env:TEMP) +GOOS ?= $(shell go env GOOS) +GOARCH ?= $(shell go env GOARCH) + GO_MAJOR_VERSION ?= $(shell (go env GOVERSION).replace("go","").split(".")[0]) GO_MINOR_VERSION ?= $(shell (go env GOVERSION).replace("go","").split(".")[1]) MINIMUM_SUPPORTED_GO_MAJOR_VERSION = 1