Skip to content

Commit d1bc045

Browse files
authored
Merge pull request #1021 from sbueringer/pr-enforce-gomod
🏃 Enforce go mod tidy via "test" presubmit
2 parents ba3ce72 + f74b0d6 commit d1bc045

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,20 @@ test: ## Run the test.sh script which will check all.
8888
TRACE=1 ./test.sh
8989

9090
test-all:
91+
$(MAKE) verify-modules
9192
$(MAKE) test
9293

9394
.PHONY: modules
9495
modules: ## Runs go mod to ensure modules are up to date.
9596
go mod tidy
9697

98+
.PHONY: verify-modules
99+
verify-modules: modules ## Verify go modules are up to date
100+
@if !(git diff --quiet HEAD -- go.sum go.mod); then \
101+
git diff; \
102+
echo "go module files are out of date, please run 'make modules'"; exit 1; \
103+
fi
104+
97105
## --------------------------------------
98106
## Cleanup / Verification
99107
## --------------------------------------

0 commit comments

Comments
 (0)