aboutsummaryrefslogtreecommitdiff
path: root/internal/postgres/postgres.go
diff options
context:
space:
mode:
authorJulie Qiu <julie@golang.org>2019-04-22 20:18:24 -0400
committerJulie Qiu <julie@golang.org>2020-03-27 16:46:35 -0400
commitaa7eb5db00effbd85341a542e7580afac866a403 (patch)
tree49539f45f90254098b66e58c254d0bc65343dbdb /internal/postgres/postgres.go
parentfc8cc4171f47d6d934967581271e4d5a6110d2f9 (diff)
downloadgo-x-pkgsite-aa7eb5db00effbd85341a542e7580afac866a403.tar.xz
internal/fetch: do not insert modules with 0 packages
There are currently a non-trivial number of modules that are inserted without packages, due to errors with packages.Load. If a module does not have any packages, it will not show up on the discovery site, so we should not insert that package to the database. Updates b/130089785 Change-Id: I6608f737fcd362a40ca96f0e41f11be4b3abba4d Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/452966 Reviewed-by: Robert Findley <rfindley@google.com>
Diffstat (limited to 'internal/postgres/postgres.go')
-rw-r--r--internal/postgres/postgres.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/postgres/postgres.go b/internal/postgres/postgres.go
index 6ce495be..5917def8 100644
--- a/internal/postgres/postgres.go
+++ b/internal/postgres/postgres.go
@@ -990,6 +990,10 @@ func validateVersion(version *internal.Version) error {
errReasons = append(errReasons, "invalid module path")
}
+ if len(version.Packages) == 0 {
+ errReasons = append(errReasons, "module does not have any packages")
+ }
+
if version.CommitTime.IsZero() {
errReasons = append(errReasons, "empty commit time")
}