Skip to content

Commit

Permalink
[v17] Add go-mod-tidy-all to Makefile and linter hint
Browse files Browse the repository at this point in the history
This will run go mod tidy in every go module directory.
If the go mod diff lint fails, it will provide a hint to run this command.
  • Loading branch information
GavinFrazar committed Dec 14, 2024
1 parent cff9058 commit 84df18b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
find . -path ./e -prune -o -name go.mod -print | while read f; do
echo "checking $f"
pushd $(dirname "$f") > /dev/null;
go mod tidy -diff;
go mod tidy -diff || (echo "Run 'make go-mod-tidy-all' to resolve" && exit 1);
popd > /dev/null;
done
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1828,3 +1828,7 @@ create-github-release:
--latest=$(LATEST) \
--verify-tag \
-F - <<< "$$NOTES"

.PHONY: go-mod-tidy-all
go-mod-tidy-all:
find . -type "f" -name "go.mod" -execdir go mod tidy \;

0 comments on commit 84df18b

Please sign in to comment.