Fix searching for licenses in single-segment modules

This commit is contained in:
Jordan Liggitt
2020-07-01 16:12:36 -04:00
parent c53ce48d48
commit 49b78b88dc
2 changed files with 207 additions and 2 deletions

View File

@@ -197,14 +197,14 @@ for PACKAGE in $(go list -m -json all | jq -r .Path | sort -f); do
continue
fi
# 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
if [[ -z "$(find "${DEPS_DIR}/${PACKAGE}/" -mindepth 1 -maxdepth 1 -type f)" ]]; then
misses_go_mod=false
while read -d "" -r SUBDIR; do
if [[ ! -e "${SUBDIR}/go.mod" ]]; then
misses_go_mod=true
break
fi
done < <(find "${DEPS_DIR}/${PACKAGE}" -mindepth 1 -maxdepth 1 -type d -print0)
done < <(find "${DEPS_DIR}/${PACKAGE}/" -mindepth 1 -maxdepth 1 -type d -print0)
if [[ $misses_go_mod = false ]]; then
echo "${PACKAGE} has no files, skipping" >&2
continue