internal/modules: exclude vendor directories in downloaded modules

For modules that have vendor directories, ecosystem metrics always
results in a loading error. 1% of the whole ecosystem has vendored
dependencies.

Vendor directories in modules downloaded from module proxy can have only
one file: modules.txt. When package loading logic sees a vendor
directory, it assumes the dependencies are there. Because they are in
fact not, loading of packages fails.

We hence remove the vendor directories altogether. This also makes
sense because, starting from go1.24, we'll see modules with vendor
directories being in principle empty, hence not even appearing in
the downloaded zip files.

This change skips unzipping the vendor directory when the module is
downloaded. An alternative approach is to explicitly delete the vendor
directory when analyzing the module. However, that has experimentally
proven unsuccessful. There is likely a file permission error.

Change-Id: I49d1f60e0e1679e586b14724f9fb729b2a8738df
Reviewed-on: https://go-review.googlesource.com/c/pkgsite-metrics/+/608095
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Zvonimir Pavlinovic <zpavlinovic@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2 files changed
tree: 1460991101f9466bbf5efda6eafbf5c15c1bcae0
  1. cmd/
  2. deploy/
  3. devtools/
  4. internal/
  5. terraform/
  6. .dockerignore
  7. .gitignore
  8. all_test.go
  9. checks.bash
  10. config.json.commented
  11. CONTRIBUTING.md
  12. go.mod
  13. go.sum
  14. LICENSE
  15. Makefile
  16. PATENTS
  17. README.md
  18. tools.go
README.md

pkgsite-metrics

This repository contains code that enables collecting and evaluating metrics for the Go ecosystem.

Report Issues / Send Patches

This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://golang.org/doc/contribute.html.

The main issue tracker for the time repository is located at https://github.com/golang/go/issues. Prefix your issue with “x/pkgsite-metrics:” in the subject line, so it is easy to find.