From 077e7cce3bfe3f0bbf4a7af644850dbfadc4956a Mon Sep 17 00:00:00 2001 From: Antonette Caldwell Date: Mon, 5 Dec 2022 21:44:07 -0600 Subject: [PATCH] Relax go req Signed-off-by: Antonette Caldwell --- Makefile | 49 +++++++++++++++++++++++------------------- build/Makefile.core.mk | 2 +- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/Makefile b/Makefile index d22377c..11293a3 100644 --- a/Makefile +++ b/Makefile @@ -21,48 +21,53 @@ include build/Makefile.show-help.mk BUILDER=buildx-multi-arch ADAPTER=traefik-mesh -v ?= 1.19.1 # Default go version to be used - - #----------------------------------------------------------------------------- # Docker-based Builds #----------------------------------------------------------------------------- -.PHONY: docker docker-run lint proto-setup proto error test run run-force-dynamic-reg - +.PHONY: docker docker-run lint error test run run-force-dynamic-reg ## Lint check Golang lint: golangci-lint run -## Build Adapter container image with "edge-latest" tag -docker: - DOCKER_BUILDKIT=1 docker build -t layer5/meshery-$(ADAPTER):$(RELEASE_CHANNEL)-latest . - -## Run Adapter container with "edge-latest" tag -docker-run: - (docker rm -f meshery-$(ADAPTER)) || true - docker run --name meshery-$(ADAPTER) -d \ - -p 10006:10006 \ - -e DEBUG=true \ - layer5/meshery-$(ADAPTER):$(RELEASE_CHANNEL)-latest - ## Build and run Adapter locally -run: - go$(v) mod tidy; \ +run: dep-check + go mod tidy; \ DEBUG=true GOPROXY=direct GOSUMDB=off go run main.go ## Build and run Adapter locally; force component registration -run-force-dynamic-reg: +run-force-dynamic-reg: dep-check FORCE_DYNAMIC_REG=true DEBUG=true GOPROXY=direct GOSUMDB=off go run main.go ## Run Meshery Error utility -error: +error: dep-check go run github.com/layer5io/meshkit/cmd/errorutil -d . analyze -i ./helpers -o ./helpers ## Run Golang tests -test: +test: dep-check export CURRENTCONTEXT="$(kubectl config current-context)" echo "current-context:" ${CURRENTCONTEXT} export KUBECONFIG="${HOME}/.kube/config" echo "environment-kubeconfig:" ${KUBECONFIG} GOPROXY=direct GOSUMDB=off GO111MODULE=on go test -v ./... + +#----------------------------------------------------------------------------- +# Dependencies +#----------------------------------------------------------------------------- +.PHONY: dep-check +#.SILENT: dep-check + +INSTALLED_GO_VERSION=$(shell go version) + +dep-check: + +ifeq (,$(findstring $(GOVERSION), $(INSTALLED_GO_VERSION))) +# Only send a warning. +# @echo "Dependency missing: go$(GOVERSION). Ensure 'go$(GOVERSION).x' is installed and available in your 'PATH'" + @echo "GOVERSION: " $(GOVERSION) + @echo "INSTALLED_GO_VERSION: " $(INSTALLED_GO_VERSION) +# Force error and stop. + $(error Found $(INSTALLED_GO_VERSION). \ + Required golang version is: 'go$(GOVERSION).x'. \ + Ensure go '$(GOVERSION).x' is installed and available in your 'PATH'.) +endif diff --git a/build/Makefile.core.mk b/build/Makefile.core.mk index 7913155..7bb7627 100644 --- a/build/Makefile.core.mk +++ b/build/Makefile.core.mk @@ -19,7 +19,7 @@ GIT_VERSION = $(shell git describe --tags `git rev-list --tags --max-count=1`) GIT_COMMITSHA = $(shell git rev-list -1 HEAD) GIT_STRIPPED_VERSION=$(shell git describe --tags `git rev-list --tags --max-count=1` | cut -c 2-) -GOVERSION = 1.19.1 +GOVERSION = 1.19 GOPATH = $(shell go env GOPATH) GOBIN = $(GOPATH)/bin