Skip to content

Commit

Permalink
Relax go req
Browse files Browse the repository at this point in the history
Signed-off-by: Antonette Caldwell <[email protected]>
  • Loading branch information
acald-creator committed Dec 6, 2022
1 parent c3d3b4e commit 077e7cc
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 23 deletions.
49 changes: 27 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion build/Makefile.core.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 077e7cc

Please sign in to comment.