Skip to content

Commit 17d08f7

Browse files
authored
scripts/gen-deps: filter out grpc modules (#7890)
1 parent ab189b0 commit 17d08f7

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

scripts/common.sh

+7
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ not() {
1111
! "$@"
1212
}
1313

14+
# noret_grep will return 0 if zero or more lines were selected, and >1 if an
15+
# error occurred. Suppresses grep's return code of 1 when there are no matches
16+
# (for eg, empty file).
17+
noret_grep() {
18+
grep "$@" || [[ $? == 1 ]]
19+
}
20+
1421
die() {
1522
echo "$@" >&2
1623
exit 1

scripts/gen-deps.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
set -e # Exit on error
44
set -o pipefail # Fail a pipe if any sub-command fails.
55

6+
source "$(dirname $0)/common.sh"
7+
68
if [[ "$#" -ne 1 || ! -d "$1" ]]; then
79
echo "Specify a valid output directory as the first parameter."
810
exit 1
@@ -16,6 +18,6 @@ cd "${SCRIPTS_DIR}/.."
1618
git ls-files -- '*.go' | grep -v '\(^\|/\)\(internal\|examples\|benchmark\|interop\|test\|testdata\)\(/\|$\)' | xargs dirname | sort -u | while read d; do
1719
pushd "$d" > /dev/null
1820
pkg="$(echo "$d" | sed 's;\.;grpc;' | sed 's;/;_;g')"
19-
go list -deps . | sort >| "${OUTPUT_DIR}/$pkg"
21+
go list -deps . | sort | noret_grep -v 'google.golang.org/grpc' >| "${OUTPUT_DIR}/$pkg"
2022
popd > /dev/null
2123
done

scripts/vet.sh

-7
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@ source "$(dirname $0)/common.sh"
88
# Check to make sure it's safe to modify the user's git repo.
99
git status --porcelain | fail_on_output
1010

11-
# noret_grep will return 0 if zero or more lines were selected, and >1 if an
12-
# error occurred. Suppresses grep's return code of 1 when there are no matches
13-
# (for eg, empty file).
14-
noret_grep() {
15-
grep "$@" || [[ $? == 1 ]]
16-
}
17-
1811
# Undo any edits made by this script.
1912
cleanup() {
2013
git reset --hard HEAD

0 commit comments

Comments
 (0)