diff --git a/Makefile b/Makefile index e28c1df90..70baaa61c 100644 --- a/Makefile +++ b/Makefile @@ -47,6 +47,10 @@ include make/git.mk ## @category Build CGO_ENABLED ?= 0 +## This flag is passed to `go build` to enable Go experiments. It's empty by default +## @category Build +GOEXPERIMENT ?= # empty by default + ## Extra flags passed to 'go' when building. For example, use GOFLAGS=-v to turn on the ## verbose output. ## @category Build diff --git a/make/tools.mk b/make/tools.mk index d4f3f333e..b49597106 100644 --- a/make/tools.mk +++ b/make/tools.mk @@ -182,11 +182,11 @@ export PATH := $(PWD)/$(BINDIR)/tools/goroot/bin:$(PATH) GO := $(PWD)/$(BINDIR)/tools/go endif -GOBUILD := CGO_ENABLED=$(CGO_ENABLED) GOMAXPROCS=$(GOBUILDPROCS) $(GO) build -GOTEST := CGO_ENABLED=$(CGO_ENABLED) $(GO) test +GOBUILD := CGO_ENABLED=$(CGO_ENABLED) GOEXPERIMENT=$(GOEXPERIMENT) GOMAXPROCS=$(GOBUILDPROCS) $(GO) build +GOTEST := CGO_ENABLED=$(CGO_ENABLED) GOEXPERIMENT=$(GOEXPERIMENT) $(GO) test -# overwrite $(GOTESTSUM) and add CGO_ENABLED variable -GOTESTSUM := CGO_ENABLED=$(CGO_ENABLED) $(GOTESTSUM) +# overwrite $(GOTESTSUM) and add relevant environment variables +GOTESTSUM := CGO_ENABLED=$(CGO_ENABLED) GOEXPERIMENT=$(GOEXPERIMENT) $(GOTESTSUM) .PHONY: vendor-go ## By default, this Makefile uses the system's Go. You can use a "vendored"