Skip to content

Commit

Permalink
Check for at most 2 require blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
bduffany committed Jan 27, 2022
1 parent 002a02e commit a43fad3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tools/fix_go_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ if ! go mod tidy -e &>"$tmp_log_file"; then
exit 1
fi

# Make sure go.mod only has two `require()` blocks.
# TODO(bduffany): Fix automatically.
require_block_count=$(grep -c '^require (' go.mod)
if ((require_block_count > 2)); then
echo "Found more than two 'require(...)' sections in go.mod." >&2
echo "Please fix by merging all require blocks into a single block, then re-running tools/fix_go_deps.sh" >&2
exit 1
fi

# Update deps.bzl (using Gazelle)
if ! "${GAZELLE_COMMAND[@]}" update-repos -from_file=go.mod \
-to_macro=deps.bzl%install_buildbuddy_dependencies &>"$tmp_log_file"; then
Expand Down

0 comments on commit a43fad3

Please sign in to comment.