Skip to content

Commit cbdf84a

Browse files
committed
handle longer vendor paths without go files
1 parent 4304f4b commit cbdf84a

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

hack/update-vendor-licenses.sh

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -197,18 +197,24 @@ for PACKAGE in $(go list -m -json all | jq -r .Path | sort -f); do
197197
continue
198198
fi
199199
# Skip a directory if 1) it has no files and 2) all the subdirectories contain a go.mod file.
200-
if [[ -z "$(find "${DEPS_DIR}/${PACKAGE}/" -mindepth 1 -maxdepth 1 -type f)" ]]; then
201-
misses_go_mod=false
200+
misses_go_mod=false
201+
DEPS_SUBDIR="${DEPS_DIR}/${PACKAGE}"
202+
search_for_mods () {
203+
if [[ -z "$(find "${DEPS_SUBDIR}/" -mindepth 1 -maxdepth 1 -type f)" ]]; then
202204
while read -d "" -r SUBDIR; do
203205
if [[ ! -e "${SUBDIR}/go.mod" ]]; then
204-
misses_go_mod=true
205-
break
206+
DEPS_SUBDIR=${SUBDIR}
207+
search_for_mods
206208
fi
207-
done < <(find "${DEPS_DIR}/${PACKAGE}/" -mindepth 1 -maxdepth 1 -type d -print0)
208-
if [[ $misses_go_mod = false ]]; then
209-
echo "${PACKAGE} has no files, skipping" >&2
210-
continue
211-
fi
209+
done < <(find "${DEPS_SUBDIR}/" -mindepth 1 -maxdepth 1 -type d -print0)
210+
else
211+
misses_go_mod=true
212+
fi
213+
}
214+
search_for_mods
215+
if [[ $misses_go_mod = false ]]; then
216+
echo "${PACKAGE} has no files, skipping" >&2
217+
continue
212218
fi
213219
echo "${PACKAGE}"
214220

0 commit comments

Comments
 (0)