Skip to content

Commit

Permalink
scripts/gen-deps: filter out grpc modules (#7890)
Browse files Browse the repository at this point in the history
  • Loading branch information
dfawley authored Dec 2, 2024
1 parent ab189b0 commit 17d08f7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
7 changes: 7 additions & 0 deletions scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ not() {
! "$@"
}

# noret_grep will return 0 if zero or more lines were selected, and >1 if an
# error occurred. Suppresses grep's return code of 1 when there are no matches
# (for eg, empty file).
noret_grep() {
grep "$@" || [[ $? == 1 ]]
}

die() {
echo "$@" >&2
exit 1
Expand Down
4 changes: 3 additions & 1 deletion scripts/gen-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
set -e # Exit on error
set -o pipefail # Fail a pipe if any sub-command fails.

source "$(dirname $0)/common.sh"

if [[ "$#" -ne 1 || ! -d "$1" ]]; then
echo "Specify a valid output directory as the first parameter."
exit 1
Expand All @@ -16,6 +18,6 @@ cd "${SCRIPTS_DIR}/.."
git ls-files -- '*.go' | grep -v '\(^\|/\)\(internal\|examples\|benchmark\|interop\|test\|testdata\)\(/\|$\)' | xargs dirname | sort -u | while read d; do
pushd "$d" > /dev/null
pkg="$(echo "$d" | sed 's;\.;grpc;' | sed 's;/;_;g')"
go list -deps . | sort >| "${OUTPUT_DIR}/$pkg"
go list -deps . | sort | noret_grep -v 'google.golang.org/grpc' >| "${OUTPUT_DIR}/$pkg"
popd > /dev/null
done
7 changes: 0 additions & 7 deletions scripts/vet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ source "$(dirname $0)/common.sh"
# Check to make sure it's safe to modify the user's git repo.
git status --porcelain | fail_on_output

# noret_grep will return 0 if zero or more lines were selected, and >1 if an
# error occurred. Suppresses grep's return code of 1 when there are no matches
# (for eg, empty file).
noret_grep() {
grep "$@" || [[ $? == 1 ]]
}

# Undo any edits made by this script.
cleanup() {
git reset --hard HEAD
Expand Down

0 comments on commit 17d08f7

Please sign in to comment.