Skip to content

Commit

Permalink
add script
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 committed Sep 4, 2024
1 parent 373ab18 commit a0dff56
Showing 1 changed file with 16 additions and 0 deletions.
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

0 comments on commit a0dff56

Please sign in to comment.