internal: deprecate LegacyReadmeFilePath and LegacyReadmeContents
For golang/go#39629
Change-Id: Ia314227f871cc44ee678aa42b06148a6d9adc417
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/258799
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
diff --git a/internal/frontend/overview_test.go b/internal/frontend/overview_test.go
index 690a498..78e5533 100644
--- a/internal/frontend/overview_test.go
+++ b/internal/frontend/overview_test.go
@@ -47,7 +47,10 @@
t.Fatal(err)
}
- readme := &internal.Readme{Filepath: tc.module.LegacyReadmeFilePath, Contents: tc.module.LegacyReadmeContents}
+ readme := &internal.Readme{
+ Filepath: sample.ReadmeFilePath,
+ Contents: sample.ReadmeContents,
+ }
got, err := constructOverviewDetails(ctx, &tc.module.ModuleInfo, readme, true, true)
if err != nil {
t.Fatal(err)
diff --git a/internal/legacy_discovery.go b/internal/legacy_discovery.go
index ef0973f..f3e3776 100644
--- a/internal/legacy_discovery.go
+++ b/internal/legacy_discovery.go
@@ -12,8 +12,6 @@
// LegacyModuleInfo holds metadata associated with a module.
type LegacyModuleInfo struct {
ModuleInfo
- LegacyReadmeFilePath string
- LegacyReadmeContents string
}
// LegacyDirectory represents a directory in a module version, and all of the
diff --git a/internal/nonredist.go b/internal/nonredist.go
index e05f1d1..c2dede3 100644
--- a/internal/nonredist.go
+++ b/internal/nonredist.go
@@ -11,15 +11,7 @@
"github.com/google/safehtml"
)
-func (m *LegacyModuleInfo) RemoveNonRedistributableData() {
- if !m.IsRedistributable {
- m.LegacyReadmeFilePath = ""
- m.LegacyReadmeContents = ""
- }
-}
-
func (m *Module) RemoveNonRedistributableData() {
- m.LegacyModuleInfo.RemoveNonRedistributableData()
for _, l := range m.Licenses {
l.RemoveNonRedistributableData()
}
@@ -45,7 +37,6 @@
}
func (d *LegacyDirectory) RemoveNonRedistributableData() {
- d.LegacyModuleInfo.RemoveNonRedistributableData()
for _, p := range d.Packages {
p.RemoveNonRedistributableData()
}
@@ -60,5 +51,4 @@
func (p *LegacyVersionedPackage) RemoveNonRedistributableData() {
p.LegacyPackage.RemoveNonRedistributableData()
- p.LegacyModuleInfo.RemoveNonRedistributableData()
}
diff --git a/internal/testing/sample/legacy.go b/internal/testing/sample/legacy.go
index a04254a..ca3e052 100644
--- a/internal/testing/sample/legacy.go
+++ b/internal/testing/sample/legacy.go
@@ -41,9 +41,7 @@
func LegacyModuleInfo(modulePath, versionString string) *internal.LegacyModuleInfo {
mi := ModuleInfo(modulePath, versionString)
return &internal.LegacyModuleInfo{
- ModuleInfo: *mi,
- LegacyReadmeFilePath: ReadmeFilePath,
- LegacyReadmeContents: ReadmeContents,
+ ModuleInfo: *mi,
}
}
@@ -108,11 +106,9 @@
UnitMeta: *UnitMeta(m.ModulePath, m.ModulePath, m.Version, "", m.IsRedistributable),
LicenseContents: Licenses,
}
- if m.LegacyReadmeFilePath != "" {
- u.Readme = &internal.Readme{
- Filepath: m.LegacyReadmeFilePath,
- Contents: m.LegacyReadmeContents,
- }
+ u.Readme = &internal.Readme{
+ Filepath: ReadmeFilePath,
+ Contents: ReadmeContents,
}
return u
}