internal/testing/sample: combine ModuleInfo and ModuleInfoReleaseType
ModuleInfo and ModuleInfoReleaseType are effectively the same function
and are combined.
internal/frontend/directory_test.go also no longer creates ModuleInfos
with version=latest.
Change-Id: Ib14f39fd2ddf6afec57c43b0b09bda42c1a8b508
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/258598
Trust: Julie Qiu <julie@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
diff --git a/internal/frontend/directory_test.go b/internal/frontend/directory_test.go
index 1ebebc1..eb281eb 100644
--- a/internal/frontend/directory_test.go
+++ b/internal/frontend/directory_test.go
@@ -170,7 +170,7 @@
},
} {
t.Run(tc.name, func(t *testing.T) {
- mi := sample.ModuleInfoReleaseType(tc.modulePath, tc.version)
+ mi := sample.ModuleInfo(tc.modulePath, tc.version)
um := &internal.UnitMeta{
Path: tc.dirPath,
ModulePath: mi.ModulePath,
diff --git a/internal/testing/sample/legacy.go b/internal/testing/sample/legacy.go
index 59fa3fb..6aa91d8 100644
--- a/internal/testing/sample/legacy.go
+++ b/internal/testing/sample/legacy.go
@@ -40,7 +40,7 @@
}
func LegacyModuleInfo(modulePath, versionString string) *internal.LegacyModuleInfo {
- mi := ModuleInfoReleaseType(modulePath, versionString)
+ mi := ModuleInfo(modulePath, versionString)
return &internal.LegacyModuleInfo{
ModuleInfo: *mi,
LegacyReadmeFilePath: ReadmeFilePath,
diff --git a/internal/testing/sample/sample.go b/internal/testing/sample/sample.go
index de80a69..1d024bb 100644
--- a/internal/testing/sample/sample.go
+++ b/internal/testing/sample/sample.go
@@ -104,13 +104,6 @@
}
func ModuleInfo(modulePath, versionString string) *internal.ModuleInfo {
- mi := ModuleInfoReleaseType(modulePath, versionString)
- return mi
-}
-
-// We shouldn't need this, but some code (notably frontend/directory_test.go) creates
-// ModuleInfos with "latest" for version, which should not be valid.
-func ModuleInfoReleaseType(modulePath, versionString string) *internal.ModuleInfo {
return &internal.ModuleInfo{
ModulePath: modulePath,
Version: versionString,