VOL-2265 test go.mod and vendor consistency;
Update dependencies to resolve `410 Gone` errors when fetching modules
Change-Id: If0bdbc1b6d629ce819b9fa4701c016df812f92d5
diff --git a/Makefile b/Makefile
index fc0ea52..305a165 100644
--- a/Makefile
+++ b/Makefile
@@ -140,9 +140,19 @@
@echo "OK"
lint-mod:
- @echo -n "Running dependency check ... "
- @echo -n $(shell go mod verify)
- @echo " ... OK"
+ go version
+ @echo "Running dependency check..."
+ @go mod verify
+ @echo "Dependency check OK. Running vendor check..."
+ @git status > /dev/null
+ @git diff-index --quiet HEAD -- go.mod go.sum vendor || (echo "ERROR: Staged or modified files must be committed before running this test" && echo "`git status`" && exit 1)
+ @[[ `git ls-files --exclude-standard --others go.mod go.sum vendor` == "" ]] || (echo "ERROR: Untracked files must be cleaned up before running this test" && echo "`git status`" && exit 1)
+ go mod tidy
+ go mod vendor
+ @git status > /dev/null
+ @git diff-index --quiet HEAD -- go.mod go.sum vendor || (echo "ERROR: Modified files detected after running go mod tidy / go mod vendor" && echo "`git status`" && exit 1)
+ @[[ `git ls-files --exclude-standard --others go.mod go.sum vendor` == "" ]] || (echo "ERROR: Untracked files detected after running go mod tidy / go mod vendor" && echo "`git status`" && exit 1)
+ @echo "Vendor check OK."
lint: lint-style lint-sanity lint-mod