internal: delete all references to Module.LegacyPackages
For golang/go#39629
Change-Id: I525d2e363057836d4e4544fc74a9943cb51fe889
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/263212
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
diff --git a/internal/discovery.go b/internal/discovery.go
index 7b6e3b2..534d131 100644
--- a/internal/discovery.go
+++ b/internal/discovery.go
@@ -99,8 +99,6 @@
// that may be contained in nested subdirectories.
Licenses []*licenses.License
Units []*Unit
-
- LegacyPackages []*LegacyPackage
}
// Packages returns all of the units for a module that are packages.
diff --git a/internal/frontend/overview_test.go b/internal/frontend/overview_test.go
index 2468989..73b0a38 100644
--- a/internal/frontend/overview_test.go
+++ b/internal/frontend/overview_test.go
@@ -58,7 +58,7 @@
}
if diff := cmp.Diff(tc.wantDetails, got, cmp.AllowUnexported(safehtml.HTML{})); diff != "" {
t.Errorf("constructOverviewDetails(%q, %q) mismatch (-want +got):\n%s",
- tc.module.LegacyPackages[0].Path, tc.module.Version, diff)
+ tc.module.Packages()[0].Path, tc.module.Version, diff)
}
}
diff --git a/internal/frontend/search_test.go b/internal/frontend/search_test.go
index b5f49a3..10954c2 100644
--- a/internal/frontend/search_test.go
+++ b/internal/frontend/search_test.go
@@ -80,20 +80,7 @@
},
}
)
-
for _, m := range []*internal.Module{moduleFoo, moduleBar} {
- // TODO(golang/go#39629): Delete once packages table is fully deprecated.
- for _, pkg := range m.Packages() {
- m.LegacyPackages = append(m.LegacyPackages, &internal.LegacyPackage{
- Path: pkg.Path,
- Name: pkg.Name,
- Synopsis: pkg.Documentation.Synopsis,
- Licenses: sample.LicenseMetadata,
- IsRedistributable: pkg.IsRedistributable,
- GOOS: pkg.Documentation.GOOS,
- GOARCH: pkg.Documentation.GOARCH,
- })
- }
if err := testDB.InsertModule(ctx, m); err != nil {
t.Fatal(err)
}
diff --git a/internal/legacy_discovery.go b/internal/legacy_discovery.go
index bac9492..62f0388 100644
--- a/internal/legacy_discovery.go
+++ b/internal/legacy_discovery.go
@@ -18,7 +18,7 @@
}
// A LegacyPackage is a group of one or more Go source files with the same
-// package header. LegacyPackages are part of a module.
+// package header.
type LegacyPackage struct {
Path string
Name string
diff --git a/internal/localdatasource/datasource.go b/internal/localdatasource/datasource.go
index c08261e..116b74b 100644
--- a/internal/localdatasource/datasource.go
+++ b/internal/localdatasource/datasource.go
@@ -73,9 +73,6 @@
for _, unit := range fr.Module.Units {
unit.IsRedistributable = true
}
- for _, pkg := range fr.Module.LegacyPackages {
- pkg.IsRedistributable = true
- }
ds.mu.Lock()
defer ds.mu.Unlock()
diff --git a/internal/nonredist.go b/internal/nonredist.go
index 37c168b..ade59aa 100644
--- a/internal/nonredist.go
+++ b/internal/nonredist.go
@@ -18,9 +18,6 @@
for _, d := range m.Units {
d.RemoveNonRedistributableData()
}
- for _, p := range m.LegacyPackages {
- p.RemoveNonRedistributableData()
- }
}
func (u *Unit) RemoveNonRedistributableData() {
diff --git a/internal/testing/sample/legacy.go b/internal/testing/sample/legacy.go
index 0b897ce..431675f 100644
--- a/internal/testing/sample/legacy.go
+++ b/internal/testing/sample/legacy.go
@@ -45,13 +45,12 @@
}
// LegacyModule creates a Module with the given path and version.
-// The list of suffixes is used to create LegacyPackages within the module.
+// The list of suffixes is used to create Units within the module.
func LegacyModule(modulePath, version string, suffixes ...string) *internal.Module {
mi := ModuleInfo(modulePath, version)
m := &internal.Module{
- ModuleInfo: *mi,
- LegacyPackages: nil,
- Licenses: Licenses,
+ ModuleInfo: *mi,
+ Licenses: Licenses,
}
m.Units = []*internal.Unit{legacyUnitForModuleRoot(mi)}
for _, s := range suffixes {
@@ -59,7 +58,6 @@
if s != "" {
LegacyAddPackage(m, lp)
} else {
- m.LegacyPackages = append(m.LegacyPackages, lp)
u := legacyUnitForPackage(lp, modulePath, version)
m.Units[0].Documentation = u.Documentation
m.Units[0].Name = u.Name
@@ -73,7 +71,6 @@
panic(fmt.Sprintf("package path %q not a prefix of module path %q",
p.Path, m.ModulePath))
}
- m.LegacyPackages = append(m.LegacyPackages, p)
AddUnit(m, legacyUnitForPackage(p, m.ModulePath, m.Version))
minLen := len(m.ModulePath)
if m.ModulePath == stdlib.ModulePath {