handle longer vendor paths without go files

This commit is contained in:
David Ashpole 2020-09-21 14:36:16 -07:00
parent 4304f4bdbd
commit cbdf84a374

View File

@ -197,18 +197,24 @@ for PACKAGE in $(go list -m -json all | jq -r .Path | sort -f); do
continue continue
fi fi
# Skip a directory if 1) it has no files and 2) all the subdirectories contain a go.mod file. # Skip a directory if 1) it has no files and 2) all the subdirectories contain a go.mod file.
if [[ -z "$(find "${DEPS_DIR}/${PACKAGE}/" -mindepth 1 -maxdepth 1 -type f)" ]]; then misses_go_mod=false
misses_go_mod=false DEPS_SUBDIR="${DEPS_DIR}/${PACKAGE}"
search_for_mods () {
if [[ -z "$(find "${DEPS_SUBDIR}/" -mindepth 1 -maxdepth 1 -type f)" ]]; then
while read -d "" -r SUBDIR; do while read -d "" -r SUBDIR; do
if [[ ! -e "${SUBDIR}/go.mod" ]]; then if [[ ! -e "${SUBDIR}/go.mod" ]]; then
misses_go_mod=true DEPS_SUBDIR=${SUBDIR}
break search_for_mods
fi fi
done < <(find "${DEPS_DIR}/${PACKAGE}/" -mindepth 1 -maxdepth 1 -type d -print0) done < <(find "${DEPS_SUBDIR}/" -mindepth 1 -maxdepth 1 -type d -print0)
if [[ $misses_go_mod = false ]]; then else
echo "${PACKAGE} has no files, skipping" >&2 misses_go_mod=true
continue fi
fi }
search_for_mods
if [[ $misses_go_mod = false ]]; then
echo "${PACKAGE} has no files, skipping" >&2
continue
fi fi
echo "${PACKAGE}" echo "${PACKAGE}"