Skip to content

scripts/gen-deps: filter out grpc modules #7890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading