mirror of
https://github.com/crowdsecurity/cs-firewall-bouncer.git
synced 2024-08-19 01:18:49 +03:00
make: remove redundant go version check (#373)
This commit is contained in:
11
Makefile
11
Makefile
@@ -1,6 +1,3 @@
|
||||
BUILD_REQUIRE_GO_MAJOR ?= 1
|
||||
BUILD_REQUIRE_GO_MINOR ?= 20
|
||||
|
||||
GO = go
|
||||
GOBUILD = $(GO) build
|
||||
GOTEST = $(GO) test
|
||||
@@ -64,7 +61,7 @@ clean: clean-release-dir clean-debian clean-rpm
|
||||
#
|
||||
|
||||
.PHONY: binary
|
||||
binary: goversion
|
||||
binary:
|
||||
$(GOBUILD) $(LD_OPTS) -o $(BINARY_NAME)
|
||||
|
||||
.PHONY: build
|
||||
@@ -79,7 +76,7 @@ lint:
|
||||
golangci-lint run
|
||||
|
||||
.PHONY: test
|
||||
test: goversion
|
||||
test:
|
||||
@$(GOTEST) $(LD_OPTS) ./...
|
||||
|
||||
.PHONY: func-tests
|
||||
@@ -133,7 +130,5 @@ release: clean tarball
|
||||
#
|
||||
|
||||
.PHONY: platform-all
|
||||
platform-all: goversion clean
|
||||
platform-all: clean
|
||||
python3 .github/release.py run-build $(BINARY_NAME)
|
||||
|
||||
include mk/goversion.mk
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
|
||||
BUILD_GOVERSION = $(subst go,,$(shell $(GO) env GOVERSION))
|
||||
|
||||
go_major_minor = $(subst ., ,$(BUILD_GOVERSION))
|
||||
GO_MAJOR_VERSION = $(word 1, $(go_major_minor))
|
||||
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)
|
||||
|
||||
|
||||
.PHONY: 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:
|
||||
@if [ $(GO_MAJOR_VERSION) -gt $(BUILD_REQUIRE_GO_MAJOR) ]; then \
|
||||
exit 0; \
|
||||
elif [ $(GO_MAJOR_VERSION) -lt $(BUILD_REQUIRE_GO_MAJOR) ]; then \
|
||||
echo '$(GO_VERSION_VALIDATION_ERR_MSG)';\
|
||||
exit 1; \
|
||||
elif [ $(GO_MINOR_VERSION) -lt $(BUILD_REQUIRE_GO_MINOR) ] ; then \
|
||||
echo '$(GO_VERSION_VALIDATION_ERR_MSG)';\
|
||||
exit 1; \
|
||||
fi
|
||||
Reference in New Issue
Block a user