Skip to content

Commit

Permalink
ci: Add makefile target to verify the local module cache (sourcenetwo…
Browse files Browse the repository at this point in the history
…rk#775)

- Resolves sourcenetwork#762 

- Introduces a Makefile target that will fail when `go mod verify` reports any changes to module cache, because by default the `go mod verify` command just prints the modules that were tampered with (doesn't fail or return an error).
  • Loading branch information
shahzadlone authored Sep 14, 2022
1 parent deb36f9 commit 530b5e3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,21 @@ dev\:start:
@$(MAKE) build
DEFRA_ENV=dev ./build/defradb start

# Note: In some situations `verify` can modify `go.sum` file, but until a
# read-only version is available we have to rely on this.
# Here are some relevant issues:
# - https://github.com/golang/go/issues/31372
# - https://github.com/cosmos/cosmos-sdk/issues/4165
.PHONY: verify
verify:
@if go mod verify | grep -q 'all modules verified'; then \
echo "Success!"; \
else \
echo "Failure:"; \
go mod verify; \
exit 2; \
fi;

.PHONY: tidy
tidy:
go mod tidy -go=1.18
Expand Down

0 comments on commit 530b5e3

Please sign in to comment.