Skip to content

Commit

Permalink
Makefile: add 'verify[-godeps]' target.
Browse files Browse the repository at this point in the history
Add a 'verify' target. It is intended to verify locally a
number of mandatory pre-PR requirements. Currently it only
verifies that go deps are up to date (using 'go mod tidy').

Signed-off-by: Krisztian Litkey <[email protected]>
  • Loading branch information
klihub authored and jukkar committed Feb 7, 2023
1 parent 6190823 commit 9144793
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ allclean: clean clean-cache

test: test-gopkgs

verify: verify-godeps

#
# build targets
#
Expand Down Expand Up @@ -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
#
Expand Down

0 comments on commit 9144793

Please sign in to comment.