Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Licensing: skip modules with fewer subdirs than mods
This came up when updating go-oidc. After updating go-oidc (with its dependency tree), cloud.google.com/go was no longer used as a package import, but still listed in the module dependency graph; as a result, "go mod vendor" no longer pulled in cloud.google.com/go itself, but update-vendor-licenses.sh still wanted a license file for it since it appeared in the list of modules. This scenario is already supposed to be handled: when a module doesn't contain any *files* as first-level content, if the number of subdirectories it contains *equals* the number of submodules it contains (excluding itself), the module is skipped. This fails for cloud.google.com/go because several submodules are included in the module dependency graph but aren't actually used, and therefore not vendored. Updating the test to check that the number of subdirectories is less than or equal to the number of expected submodules fixes this. The correct fix would be to process the submodules first, keeping a note of which ones really have content, then check that the top-level module only contains subdirectories corresponding to those modules; but it's not clear to me that this is worth the effort (especially in a shell script). Signed-off-by: Stephen Kitt <skitt@redhat.com>
- Loading branch information