diff --git a/Makefile b/Makefile index 4b4440c03..17a2c7888 100644 --- a/Makefile +++ b/Makefile @@ -108,6 +108,8 @@ allclean: clean clean-cache test: test-gopkgs +verify: verify-godeps + # # build targets # @@ -213,6 +215,18 @@ vet: golangci-lint: $(Q)$(GOLANG_CILINT) run +verify-godeps: + $(Q) $(GO_CMD) mod tidy && git diff --quiet; ec="$$?"; \ + if [ "$$ec" != "0" ]; then \ + echo "ERROR: go mod dependencies are not up-to-date."; \ + echo "ERROR:"; \ + git --no-pager diff go.mod go.sum | sed 's/^/ERROR: /g'; \ + echo "ERROR:"; \ + echo "ERROR: please run 'go mod tidy' and commit these changes."; \ + exit "$$ec"; \ + fi; \ + $(GO_CMD) mod verify + # # targets for installing dependencies #