From 29c5f31f908e13bf4341400012f3350616423686 Mon Sep 17 00:00:00 2001 From: Nathan Brown Date: Tue, 2 Mar 2021 13:29:05 -0600 Subject: [PATCH] Add a check in the makefile to ensure a minimum version of go is installed (#383) --- Makefile | 10 ++++++++++ go.mod | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5159ebc..cbd5b65 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,16 @@ +GOMINVERSION = 1.16 NEBULA_CMD_PATH = "./cmd/nebula" BUILD_NUMBER ?= dev+$(shell date -u '+%Y%m%d%H%M%S') GO111MODULE = on export GO111MODULE +# Ensure the version of go we are using is at least what is defined in GOMINVERSION at the top of this file +GOVERSION := $(shell go version | awk '{print substr($$3, 3)}') +GOISMIN := $(shell expr "$(GOVERSION)" ">=" "$(GOMINVERSION)") +ifneq "$(GOISMIN)" "1" +$(error "go version $(GOVERSION) is not supported, upgrade to $(GOMINVERSION) or above") +endif + LDFLAGS = -X main.Build=$(BUILD_NUMBER) ALL_LINUX = linux-amd64 \ @@ -24,6 +32,8 @@ ALL = $(ALL_LINUX) \ freebsd-amd64 \ windows-amd64 + + all: $(ALL:%=build/%/nebula) $(ALL:%=build/%/nebula-cert) release: $(ALL:%=build/nebula-%.tar.gz) diff --git a/go.mod b/go.mod index ed0a165..b2a6319 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/slackhq/nebula -go 1.12 +go 1.16 require ( github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239