[VOL-1920] Migrated voltha-go from dep to go mod for dependency management
Change-Id: Ie14418cef7ba046a7c43a343b9017c436af6b395
diff --git a/Makefile b/Makefile
index f92780c..c2a5e0a 100644
--- a/Makefile
+++ b/Makefile
@@ -40,6 +40,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}" \
@@ -73,7 +80,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
@@ -168,15 +175,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
# Rules to automatically install golangci-lint
GOLANGCI_LINT_TOOL?=$(shell which golangci-lint)
@@ -217,7 +224,7 @@
test: go_junit_install gocover_cobertura_install
@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 ;\