From ef76aef7f366754802d3cd5dda2d5e22a11c364a Mon Sep 17 00:00:00 2001 From: Aditya Sharma Date: Thu, 21 Jul 2022 11:54:00 -0700 Subject: [PATCH] Require Go 1.18 Signed-off-by: Aditya Sharma --- makelib/golang.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/makelib/golang.mk b/makelib/golang.mk index c5e3528..f9527c5 100644 --- a/makelib/golang.mk +++ b/makelib/golang.mk @@ -84,6 +84,10 @@ GOIMPORTS := $(TOOLS_HOST_DIR)/goimports GO := go GOHOST := GOOS=$(GOHOSTOS) GOARCH=$(GOHOSTARCH) go GO_VERSION := $(shell $(GO) version | sed -ne 's/[^0-9]*\(\([0-9]\.\)\{0,4\}[0-9][^.]\).*/\1/p') +GO_VERSION_MIN := 1.18 +ifneq ($(GO_VERSION),$(GO_VERSION_MIN)) +$(error "go version $(GO_VERSION) is less than $(GO_VERSION_MIN)") +endif # we use a consistent version of gofmt even while running different go compilers. # see https://github.com/golang/go/issues/26397 for more details