VOL-1985 Migrate voltha-simonu-adapter to go mod
Change-Id: I0dedc208a64e7478c4ef6adc0287430e7b7d6702
diff --git a/Makefile b/Makefile
index f3a6ea7..08ca056 100644
--- a/Makefile
+++ b/Makefile
@@ -37,6 +37,13 @@
DOCKER_LABEL_BUILD_DATE ?= $(shell date -u "+%Y-%m-%dT%H:%M:%SZ")
DOCKER_LABEL_COMMIT_DATE = $(shell git show -s --format=%cd --date=iso-strict HEAD)
+# Default is GO111MODULE=auto, which will refuse to use go mod if running
+# go less than 1.13.0 and this repository is checked out in GOPATH. For now,
+# force module usage. This affects commands executed from this Makefile, but
+# not the environment inside the Docker build (which does not build from
+# inside a GOPATH).
+export GO111MODULE=on
+
DOCKER_BUILD_ARGS ?= \
${DOCKER_EXTRA_ARGS} \
--build-arg org_label_schema_version="${VERSION}" \
@@ -65,7 +72,7 @@
@echo "lint-dockerfile : Perform static analysis on Dockerfiles"
@echo "lint-style : Verify code is properly gofmt-ed"
@echo "lint-sanity : Verify that 'go vet' doesn't report any issues"
- @echo "lint-dep : Verify the integrity of the 'dep' files"
+ @echo "lint-mod : Verify the integrity of the 'mod' files"
@echo "lint : Shorthand for lint-style & lint-sanity"
@echo "test : Generate reports for all go tests"
@echo
@@ -118,15 +125,15 @@
lint-sanity:
@echo "Running sanity check..."
- @go vet ./...
+ @go vet -mod=vendor ./...
@echo "Sanity check OK"
-lint-dep:
+lint-mod:
@echo "Running dependency check..."
- @dep check
+ @go mod verify
@echo "Dependency check OK"
-lint: lint-style lint-sanity lint-dep lint-dockerfile
+lint: lint-style lint-sanity lint-mod lint-dockerfile
GO_JUNIT_REPORT:=$(shell which go-junit-report)
GOCOVER_COBERTURA:=$(shell which gocover-cobertura)
@@ -141,7 +148,7 @@
@GOCOVER_COBERTURA=$(GOPATH)/bin/gocover-cobertura
endif
@mkdir -p ./tests/results
- @go test -v -coverprofile ./tests/results/go-test-coverage.out -covermode count ./... 2>&1 | tee ./tests/results/go-test-results.out ;\
+ @go test -mod=vendor -v -coverprofile ./tests/results/go-test-coverage.out -covermode count ./... 2>&1 | tee ./tests/results/go-test-results.out ;\
RETURN=$$? ;\
$(GO_JUNIT_REPORT) < ./tests/results/go-test-results.out > ./tests/results/go-test-results.xml ;\
$(GOCOVER_COBERTURA) < ./tests/results/go-test-coverage.out > ./tests/results/go-test-coverage.xml ;\