Skip to content

Commit 2eac55e

Browse files
authored
GODRIVER-3329 Update the check-modules make target to include submodules (#1787)
1 parent 0880655 commit 2eac55e

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

Makefile

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,9 @@ install-lll:
4848
check-fmt: install-lll
4949
etc/check_fmt.sh
5050

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

6055
.PHONY: doc
6156
doc:

etc/check_modules.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
# check-modules runs "go mod tidy" on each module and exits with a non-zero exit code if there
3+
# are any module changes. The intent is to confirm that exactly the required
4+
# modules are declared as dependencies. We should always be able to run "go mod
5+
# tidy" and expect that no unrelated changes are made to the "go.mod" file.
6+
set -eu
7+
8+
mods=$(find . -name go.mod)
9+
for mod in $mods; do
10+
pushd $(dirname $mod) > /dev/null
11+
echo "Checking $mod..."
12+
go mod tidy -v
13+
git diff --exit-code go.mod go.sum
14+
echo "Checking $mod... done"
15+
popd > /dev/null
16+
done

0 commit comments

Comments
 (0)