Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,9 @@ install-lll:
check-fmt: install-lll
etc/check_fmt.sh

# check-modules runs "go mod tidy" and exits with a non-zero exit code if there
# are any module changes. The intent is to confirm that exactly the required
# modules are declared as dependencies. We should always be able to run "go mod
# tidy" and expect that no unrelated changes are made to the "go.mod" file.
.PHONY: check-modules
check-modules:
go mod tidy -v
git diff --exit-code go.mod go.sum
etc/check_modules.sh

.PHONY: doc
doc:
Expand Down
16 changes: 16 additions & 0 deletions etc/check_modules.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
# check-modules runs "go mod tidy" on each module and exits with a non-zero exit code if there
# are any module changes. The intent is to confirm that exactly the required
# modules are declared as dependencies. We should always be able to run "go mod
# tidy" and expect that no unrelated changes are made to the "go.mod" file.
set -eu

mods=$(find . -name go.mod)
for mod in $mods; do
pushd $(dirname $mod) > /dev/null
echo "Checking $mod..."
go mod tidy -v
git diff --exit-code go.mod go.sum
echo "Checking $mod... done"
popd > /dev/null
done
Loading