From 68e142098288e85d5d660472bf33253142907735 Mon Sep 17 00:00:00 2001 From: Peter Nose Date: Tue, 23 May 2023 20:13:51 +0200 Subject: [PATCH] makefile: Exit with an error if go mod tidy fails --- .changelog/5270.internal.md | 1 + common.mk | 2 +- go/Makefile | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 .changelog/5270.internal.md diff --git a/.changelog/5270.internal.md b/.changelog/5270.internal.md new file mode 100644 index 00000000000..2907ae4894b --- /dev/null +++ b/.changelog/5270.internal.md @@ -0,0 +1 @@ +makefile: Exit with an error if go mod tidy fails diff --git a/common.mk b/common.mk index 9697ac503fb..8da10543e43 100644 --- a/common.mk +++ b/common.mk @@ -166,7 +166,7 @@ endef # NOTE: go mod tidy doesn't implement a check mode yet. # For more details, see: https://github.com/golang/go/issues/27005. define CHECK_GO_MOD_TIDY = - $(GO) mod tidy; \ + $(GO) mod tidy && \ if [[ ! -z `git status --porcelain go.mod go.sum` ]]; then \ $(ECHO) "$(RED)Error: The following changes detected after running 'go mod tidy':$(OFF)"; \ git diff go.mod go.sum; \ diff --git a/go/Makefile b/go/Makefile index eaa1c2daacf..d299c2d9313 100644 --- a/go/Makefile +++ b/go/Makefile @@ -105,7 +105,7 @@ clean: generate $(go-binaries) $(go-plugins) build \ $(test-helpers) build-helpers \ $(test-vectors-targets) \ - fmt lint \ + fmt lint lint-mod-tidy \ $(test-targets) test force-test \ clean all