internal/testing/sample: rename LegacyModule to Module

For golang/go#39629

Change-Id: I83c2afdf32b58594e9ab00b545ae1bfebbd5491b
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/265005
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/imports_test.go b/internal/frontend/imports_test.go
index d546bb5..7fc832c 100644
--- a/internal/frontend/imports_test.go
+++ b/internal/frontend/imports_test.go
@@ -49,7 +49,7 @@
 			ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
 			defer cancel()
 
-			module := sample.LegacyModule(sample.ModulePath, sample.VersionString, sample.Suffix)
+			module := sample.Module(sample.ModulePath, sample.VersionString, sample.Suffix)
 			// The first unit is the module and the second one is the package.
 			pkg := module.Units[1]
 			pkg.Imports = tc.imports
@@ -79,7 +79,7 @@
 	defer cancel()
 
 	newModule := func(modPath string, pkgs ...*internal.Unit) *internal.Module {
-		m := sample.LegacyModule(modPath, sample.VersionString)
+		m := sample.Module(modPath, sample.VersionString)
 		for _, p := range pkgs {
 			sample.AddUnit(m, p)
 		}
diff --git a/internal/frontend/license_test.go b/internal/frontend/license_test.go
index b48e73d..cf34ce1 100644
--- a/internal/frontend/license_test.go
+++ b/internal/frontend/license_test.go
@@ -44,10 +44,10 @@
 }
 
 func TestFetchLicensesDetails(t *testing.T) {
-	testModule := sample.LegacyModule(sample.ModulePath, "v1.2.3", "A/B")
-	stdlibModule := sample.LegacyModule(stdlib.ModulePath, "v1.13.0", "cmd/go")
+	testModule := sample.Module(sample.ModulePath, "v1.2.3", "A/B")
+	stdlibModule := sample.Module(stdlib.ModulePath, "v1.13.0", "cmd/go")
 	crlfPath := "github.com/crlf/module_name"
-	crlfModule := sample.LegacyModule(crlfPath, "v1.2.3", "A")
+	crlfModule := sample.Module(crlfPath, "v1.2.3", "A")
 
 	mit := &licenses.Metadata{Types: []string{"MIT"}, FilePath: "LICENSE"}
 	bsd := &licenses.Metadata{Types: []string{"BSD-3-Clause"}, FilePath: "A/B/LICENSE"}
diff --git a/internal/frontend/overview_test.go b/internal/frontend/overview_test.go
index 73b0a38..a6f4bc2 100644
--- a/internal/frontend/overview_test.go
+++ b/internal/frontend/overview_test.go
@@ -146,7 +146,7 @@
 	} {
 		t.Run(test.name, func(t *testing.T) {
 			defer postgres.ResetTestDB(testDB, t)
-			m := sample.LegacyModule(
+			m := sample.Module(
 				test.dir.ModulePath,
 				test.dir.Version,
 				internal.Suffix(test.dir.Path, test.dir.ModulePath))
diff --git a/internal/frontend/package_test.go b/internal/frontend/package_test.go
index c0993dd..b840888 100644
--- a/internal/frontend/package_test.go
+++ b/internal/frontend/package_test.go
@@ -16,7 +16,7 @@
 func TestStdlibPathForShortcut(t *testing.T) {
 	defer postgres.ResetTestDB(testDB, t)
 
-	m := sample.LegacyModule(stdlib.ModulePath, "v1.2.3",
+	m := sample.Module(stdlib.ModulePath, "v1.2.3",
 		"encoding/json",                  // one match for "json"
 		"text/template", "html/template", // two matches for "template"
 	)
diff --git a/internal/frontend/search_test.go b/internal/frontend/search_test.go
index 10954c2..af18626 100644
--- a/internal/frontend/search_test.go
+++ b/internal/frontend/search_test.go
@@ -195,8 +195,8 @@
 	defer cancel()
 	defer postgres.ResetTestDB(testDB, t)
 
-	golangTools := sample.LegacyModule("golang.org/x/tools", sample.VersionString, "internal/lsp")
-	std := sample.LegacyModule("std", sample.VersionString,
+	golangTools := sample.Module("golang.org/x/tools", sample.VersionString, "internal/lsp")
+	std := sample.Module("std", sample.VersionString,
 		"cmd/go", "cmd/go/internal/auth", "fmt")
 	modules := []*internal.Module{golangTools, std}
 
diff --git a/internal/frontend/server_test.go b/internal/frontend/server_test.go
index f7784a5..384abb5 100644
--- a/internal/frontend/server_test.go
+++ b/internal/frontend/server_test.go
@@ -156,7 +156,7 @@
 			pkgs[pkg.suffix] = pkg
 		}
 		for _, ver := range mod.versions {
-			m := sample.LegacyModule(mod.path, ver, suffixes...)
+			m := sample.Module(mod.path, ver, suffixes...)
 			m.SourceInfo = source.NewGitHubInfo(sample.RepositoryURL, "", ver)
 			m.IsRedistributable = mod.redistributable
 			if !m.IsRedistributable {
diff --git a/internal/frontend/unit_header_test.go b/internal/frontend/unit_header_test.go
index 541cade..3ac2d3e 100644
--- a/internal/frontend/unit_header_test.go
+++ b/internal/frontend/unit_header_test.go
@@ -24,7 +24,7 @@
 func TestPageTitlePageTypePageLabels(t *testing.T) {
 
 	var tests []*testUnitPage
-	m := sample.LegacyModule("golang.org/x/tools", "v1.0.0", "go/packages", "cmd/godoc")
+	m := sample.Module("golang.org/x/tools", "v1.0.0", "go/packages", "cmd/godoc")
 	for _, u := range m.Units {
 		um := &u.UnitMeta
 		switch um.Path {
@@ -44,11 +44,11 @@
 		}
 	}
 
-	m2 := sample.LegacyModule("golang.org/x/tools/gopls", "v1.0.0", "")
+	m2 := sample.Module("golang.org/x/tools/gopls", "v1.0.0", "")
 	m2.Units[0].Name = "main"
 	tests = append(tests, &testUnitPage{&m2.Units[0].UnitMeta, "module golang.org/x/tools/gopls", "gopls", pageTypeCommand, []string{pageTypeCommand, pageTypeModule}})
 
-	std := sample.LegacyModule(stdlib.ModulePath, "v1.0.0", "cmd/go")
+	std := sample.Module(stdlib.ModulePath, "v1.0.0", "cmd/go")
 	for _, u := range std.Units {
 		um := &u.UnitMeta
 		switch um.Path {
diff --git a/internal/frontend/unit_main_test.go b/internal/frontend/unit_main_test.go
index 7e08f6c..af733bf 100644
--- a/internal/frontend/unit_main_test.go
+++ b/internal/frontend/unit_main_test.go
@@ -21,14 +21,14 @@
 	defer postgres.ResetTestDB(testDB, t)
 
 	for _, m := range []*internal.Module{
-		sample.LegacyModule("cloud.google.com/go", "v0.46.2", "storage", "spanner", "pubsub"),
-		sample.LegacyModule("cloud.google.com/go/pubsub", "v1.6.1", sample.Suffix),
-		sample.LegacyModule("cloud.google.com/go/spanner", "v1.9.0", sample.Suffix),
-		sample.LegacyModule("cloud.google.com/go/storage", "v1.10.0", sample.Suffix),
-		sample.LegacyModule("cloud.google.com/go/storage/v11", "v11.0.0", sample.Suffix),
-		sample.LegacyModule("cloud.google.com/go/storage/v9", "v9.0.0", sample.Suffix),
-		sample.LegacyModule("cloud.google.com/go/storage/module", "v1.10.0", sample.Suffix),
-		sample.LegacyModule("cloud.google.com/go/v2", "v2.0.0", "storage", "spanner", "pubsub"),
+		sample.Module("cloud.google.com/go", "v0.46.2", "storage", "spanner", "pubsub"),
+		sample.Module("cloud.google.com/go/pubsub", "v1.6.1", sample.Suffix),
+		sample.Module("cloud.google.com/go/spanner", "v1.9.0", sample.Suffix),
+		sample.Module("cloud.google.com/go/storage", "v1.10.0", sample.Suffix),
+		sample.Module("cloud.google.com/go/storage/v11", "v11.0.0", sample.Suffix),
+		sample.Module("cloud.google.com/go/storage/v9", "v9.0.0", sample.Suffix),
+		sample.Module("cloud.google.com/go/storage/module", "v1.10.0", sample.Suffix),
+		sample.Module("cloud.google.com/go/v2", "v2.0.0", "storage", "spanner", "pubsub"),
 	} {
 		if err := testDB.InsertModule(ctx, m); err != nil {
 			t.Fatal(err)
@@ -95,7 +95,7 @@
 	defer cancel()
 
 	newModule := func(modPath string, pkgs ...*internal.Unit) *internal.Module {
-		m := sample.LegacyModule(modPath, sample.VersionString)
+		m := sample.Module(modPath, sample.VersionString)
 		for _, p := range pkgs {
 			sample.AddUnit(m, p)
 		}
diff --git a/internal/frontend/versions_test.go b/internal/frontend/versions_test.go
index e6900ca..6794deb 100644
--- a/internal/frontend/versions_test.go
+++ b/internal/frontend/versions_test.go
@@ -23,9 +23,9 @@
 
 func sampleModule(modulePath, version string, versionType version.Type, packages ...*internal.Unit) *internal.Module {
 	if len(packages) == 0 {
-		return sample.LegacyModule(modulePath, version, sample.Suffix)
+		return sample.Module(modulePath, version, sample.Suffix)
 	}
-	m := sample.LegacyModule(modulePath, version)
+	m := sample.Module(modulePath, version)
 	for _, p := range packages {
 		sample.AddUnit(m, p)
 	}
diff --git a/internal/postgres/details_test.go b/internal/postgres/details_test.go
index ccd4dbc..f1916cb 100644
--- a/internal/postgres/details_test.go
+++ b/internal/postgres/details_test.go
@@ -32,10 +32,10 @@
 			name: "Nested Modules in cloud.google.com/go that have the same module prefix path",
 			path: "cloud.google.com/go",
 			modules: []*internal.Module{
-				sample.LegacyModule("cloud.google.com/go", "v0.46.2", "storage", "spanner", "pubsub"),
-				sample.LegacyModule("cloud.google.com/go/storage", "v1.10.0", sample.Suffix),
-				sample.LegacyModule("cloud.google.com/go/spanner", "v1.9.0", sample.Suffix),
-				sample.LegacyModule("cloud.google.com/go/pubsub", "v1.6.1", sample.Suffix),
+				sample.Module("cloud.google.com/go", "v0.46.2", "storage", "spanner", "pubsub"),
+				sample.Module("cloud.google.com/go/storage", "v1.10.0", sample.Suffix),
+				sample.Module("cloud.google.com/go/spanner", "v1.9.0", sample.Suffix),
+				sample.Module("cloud.google.com/go/pubsub", "v1.6.1", sample.Suffix),
 			},
 			wantModulePaths: []string{
 				"cloud.google.com/go/pubsub",
@@ -47,10 +47,10 @@
 			name: "Nested Modules in cloud.google.com/go that have multiple major versions",
 			path: "cloud.google.com/go",
 			modules: []*internal.Module{
-				sample.LegacyModule("cloud.google.com/go", "v0.46.2", "storage", "spanner", "pubsub"),
-				sample.LegacyModule("cloud.google.com/go/storage", "v1.10.0", sample.Suffix),
-				sample.LegacyModule("cloud.google.com/go/storage/v9", "v9.0.0", sample.Suffix),
-				sample.LegacyModule("cloud.google.com/go/storage/v11", "v11.0.0", sample.Suffix),
+				sample.Module("cloud.google.com/go", "v0.46.2", "storage", "spanner", "pubsub"),
+				sample.Module("cloud.google.com/go/storage", "v1.10.0", sample.Suffix),
+				sample.Module("cloud.google.com/go/storage/v9", "v9.0.0", sample.Suffix),
+				sample.Module("cloud.google.com/go/storage/v11", "v11.0.0", sample.Suffix),
 			},
 			wantModulePaths: []string{
 				"cloud.google.com/go/storage/v11",
@@ -60,8 +60,8 @@
 			name: "Nested Modules in golang.org/x/tools/v2 that have the same module prefix path",
 			path: "golang.org/x/tools/v2",
 			modules: []*internal.Module{
-				sample.LegacyModule("golang.org/x/tools", "v0.0.1", sample.Suffix),
-				sample.LegacyModule("golang.org/x/tools/gopls", "v0.5.1", sample.Suffix),
+				sample.Module("golang.org/x/tools", "v0.0.1", sample.Suffix),
+				sample.Module("golang.org/x/tools/gopls", "v0.5.1", sample.Suffix),
 			},
 			wantModulePaths: []string{
 				"golang.org/x/tools/gopls",
@@ -106,11 +106,11 @@
 		name: "Nested Modules in cloud.google.com/go that have the same module prefix path",
 		path: "cloud.google.com/go",
 		modules: []*internal.Module{
-			sample.LegacyModule("cloud.google.com/go", "v0.46.2", "storage", "spanner", "pubsub"),
+			sample.Module("cloud.google.com/go", "v0.46.2", "storage", "spanner", "pubsub"),
 			// cloud.google.com/storage will be excluded below.
-			sample.LegacyModule("cloud.google.com/go/storage", "v1.10.0", sample.Suffix),
-			sample.LegacyModule("cloud.google.com/go/pubsub", "v1.6.1", sample.Suffix),
-			sample.LegacyModule("cloud.google.com/go/spanner", "v1.9.0", sample.Suffix),
+			sample.Module("cloud.google.com/go/storage", "v1.10.0", sample.Suffix),
+			sample.Module("cloud.google.com/go/pubsub", "v1.6.1", sample.Suffix),
+			sample.Module("cloud.google.com/go/spanner", "v1.9.0", sample.Suffix),
 		},
 		wantModulePaths: []string{
 			"cloud.google.com/go/pubsub",
@@ -156,9 +156,9 @@
 			path:    "mod.1",
 			version: "v1.0.2",
 			modules: []*internal.Module{
-				sample.LegacyModule("mod.1", "v1.1.0", sample.Suffix),
-				sample.LegacyModule("mod.1", "v1.0.2", sample.Suffix),
-				sample.LegacyModule("mod.1", "v1.0.0", sample.Suffix),
+				sample.Module("mod.1", "v1.1.0", sample.Suffix),
+				sample.Module("mod.1", "v1.0.2", sample.Suffix),
+				sample.Module("mod.1", "v1.0.0", sample.Suffix),
 			},
 			wantIndex: 1,
 		},
@@ -167,9 +167,9 @@
 			path:    "mod.2",
 			version: "v1.0.3",
 			modules: []*internal.Module{
-				sample.LegacyModule("mod.2", "v1.1.0", sample.Suffix),
-				sample.LegacyModule("mod.2", "v1.0.2", sample.Suffix),
-				sample.LegacyModule("mod.2", "v1.0.0", sample.Suffix),
+				sample.Module("mod.2", "v1.1.0", sample.Suffix),
+				sample.Module("mod.2", "v1.0.2", sample.Suffix),
+				sample.Module("mod.2", "v1.0.0", sample.Suffix),
 			},
 			wantErr: derrors.NotFound,
 		},
@@ -212,9 +212,9 @@
 
 func TestGetImportedBy(t *testing.T) {
 	var (
-		m1          = sample.LegacyModule("path.to/foo", "v1.1.0", "bar")
-		m2          = sample.LegacyModule("path2.to/foo", "v1.2.0", "bar2")
-		m3          = sample.LegacyModule("path3.to/foo", "v1.3.0", "bar3")
+		m1          = sample.Module("path.to/foo", "v1.1.0", "bar")
+		m2          = sample.Module("path2.to/foo", "v1.2.0", "bar2")
+		m3          = sample.Module("path3.to/foo", "v1.3.0", "bar3")
 		testModules = []*internal.Module{m1, m2, m3}
 
 		pkg1 = m1.Packages()[0]
diff --git a/internal/postgres/insert_module_test.go b/internal/postgres/insert_module_test.go
index dc1182e..f5dc4c7 100644
--- a/internal/postgres/insert_module_test.go
+++ b/internal/postgres/insert_module_test.go
@@ -42,7 +42,7 @@
 		},
 		{
 			name:   "valid test with internal package",
-			module: sample.LegacyModule(sample.ModulePath, sample.VersionString, "internal/foo"),
+			module: sample.Module(sample.ModulePath, sample.VersionString, "internal/foo"),
 		},
 		{
 			name: "valid test with go.mod missing",
@@ -54,7 +54,7 @@
 		},
 		{
 			name:   "stdlib",
-			module: sample.LegacyModule("std", "v1.12.5", "context"),
+			module: sample.Module("std", "v1.12.5", "context"),
 		},
 	} {
 		t.Run(test.name, func(t *testing.T) {
@@ -134,7 +134,7 @@
 				}
 			}
 
-			mod := sample.LegacyModule(sample.ModulePath, sample.VersionString, "")
+			mod := sample.Module(sample.ModulePath, sample.VersionString, "")
 			checkHasRedistData(mod.Units[0].Readme.Contents, mod.Units[0].Documentation.HTML, true)
 			mod.IsRedistributable = false
 			mod.Units[0].IsRedistributable = false
@@ -169,7 +169,7 @@
 func TestUpsertModule(t *testing.T) {
 	ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
 	defer cancel()
-	m := sample.LegacyModule("upsert.org", "v1.2.3", "dir/p")
+	m := sample.Module("upsert.org", "v1.2.3", "dir/p")
 
 	// Insert the module.
 	if err := testDB.InsertModule(ctx, m); err != nil {
@@ -226,7 +226,7 @@
 		},
 		{
 			name:           "missing module path",
-			module:         sample.LegacyModule("", sample.VersionString),
+			module:         sample.Module("", sample.VersionString),
 			wantVersion:    sample.VersionString,
 			wantModulePath: sample.ModulePath,
 			wantWriteErr:   derrors.DBModuleInsertInvalid,
@@ -275,7 +275,7 @@
 		sortVersion, seriesPath string
 	}
 
-	v := sample.LegacyModule("github.com/user/repo/path/v2", "v1.2.3-beta.4.a", sample.Suffix)
+	v := sample.Module("github.com/user/repo/path/v2", "v1.2.3-beta.4.a", sample.Suffix)
 	want := other{
 		sortVersion: "1,2,3,~beta,4,~a",
 		seriesPath:  "github.com/user/repo/path",
@@ -479,7 +479,7 @@
 	if err != nil {
 		t.Fatal(err)
 	}
-	m := sample.LegacyModule(modulePath, okVersion, "p")
+	m := sample.Module(modulePath, okVersion, "p")
 	if err := testDB.InsertModule(ctx, m); err != nil {
 		t.Fatal(err)
 	}
diff --git a/internal/postgres/licenses_test.go b/internal/postgres/licenses_test.go
index 829e13e..d18e6c9 100644
--- a/internal/postgres/licenses_test.go
+++ b/internal/postgres/licenses_test.go
@@ -19,8 +19,8 @@
 )
 
 func TestGetLicenses(t *testing.T) {
-	testModule := sample.LegacyModule(sample.ModulePath, "v1.2.3", "A/B")
-	stdlibModule := sample.LegacyModule(stdlib.ModulePath, "v1.13.0", "cmd/go")
+	testModule := sample.Module(sample.ModulePath, "v1.2.3", "A/B")
+	stdlibModule := sample.Module(stdlib.ModulePath, "v1.13.0", "cmd/go")
 	mit := &licenses.Metadata{Types: []string{"MIT"}, FilePath: "LICENSE"}
 	bsd := &licenses.Metadata{Types: []string{"BSD-3-Clause"}, FilePath: "A/B/LICENSE"}
 
@@ -123,7 +123,7 @@
 
 func TestGetModuleLicenses(t *testing.T) {
 	modulePath := "test.module"
-	testModule := sample.LegacyModule(modulePath, "v1.2.3", "", "foo", "bar")
+	testModule := sample.Module(modulePath, "v1.2.3", "", "foo", "bar")
 	testModule.Packages()[0].Licenses = []*licenses.Metadata{{Types: []string{"ISC"}, FilePath: "LICENSE"}}
 	testModule.Packages()[1].Licenses = []*licenses.Metadata{{Types: []string{"MIT"}, FilePath: "foo/LICENSE"}}
 	testModule.Packages()[2].Licenses = []*licenses.Metadata{{Types: []string{"GPL2"}, FilePath: "bar/LICENSE.txt"}}
@@ -198,7 +198,7 @@
 }
 
 func nonRedistributableModule() *internal.Module {
-	m := sample.LegacyModule(sample.ModulePath, "v1.2.3", "")
+	m := sample.Module(sample.ModulePath, "v1.2.3", "")
 	sample.AddLicense(m, sample.NonRedistributableLicense)
 	m.IsRedistributable = false
 	m.Packages()[0].IsRedistributable = false
diff --git a/internal/postgres/path_test.go b/internal/postgres/path_test.go
index e91176e..9d75aaa 100644
--- a/internal/postgres/path_test.go
+++ b/internal/postgres/path_test.go
@@ -37,7 +37,7 @@
 		{"m.com/a", "v1.1.0", "b", false},
 		{"m.com/b", "v2.0.0+incompatible", "a", true},
 	} {
-		m := sample.LegacyModule(testModule.module, testModule.version, testModule.packageSuffix)
+		m := sample.Module(testModule.module, testModule.version, testModule.packageSuffix)
 		if err := testDB.InsertModule(ctx, m); err != nil {
 			t.Fatal(err)
 		}
@@ -216,7 +216,7 @@
 		{"m.com/a", "v1.1.0", "b", false},
 		{"m.com/b", "v2.0.0+incompatible", "a", true},
 	} {
-		m := sample.LegacyModule(testModule.module, testModule.version, testModule.packageSuffix)
+		m := sample.Module(testModule.module, testModule.version, testModule.packageSuffix)
 		makeModuleNonRedistributable(m)
 
 		if err := bypassDB.InsertModule(ctx, m); err != nil {
@@ -417,7 +417,7 @@
 			},
 		},
 	} {
-		m := sample.LegacyModule(stdlib.ModulePath, data.version, data.suffixes...)
+		m := sample.Module(stdlib.ModulePath, data.version, data.suffixes...)
 		for _, p := range m.Packages() {
 			p.Imports = nil
 		}
diff --git a/internal/postgres/search_test.go b/internal/postgres/search_test.go
index 94a9521..e5a8218 100644
--- a/internal/postgres/search_test.go
+++ b/internal/postgres/search_test.go
@@ -153,7 +153,7 @@
 // one popular package.  For performance purposes, all importers are added to
 // a single importing module.
 func importGraph(popularPath, importerModule string, importerCount int) []*internal.Module {
-	m := sample.LegacyModule(popularPath, "v1.2.3", "")
+	m := sample.Module(popularPath, "v1.2.3", "")
 	m.Packages()[0].Imports = nil
 	// Try to improve the ts_rank of the 'foo' search term.
 	m.Packages()[0].Documentation.Synopsis = "foo"
@@ -161,7 +161,7 @@
 	mods := []*internal.Module{m}
 
 	if importerCount > 0 {
-		m := sample.LegacyModule(importerModule, "v1.2.3")
+		m := sample.Module(importerModule, "v1.2.3")
 		for i := 0; i < importerCount; i++ {
 			name := fmt.Sprintf("importer%d", i)
 			fullPath := importerModule + "/" + name
@@ -545,7 +545,7 @@
 
 				for modulePath, pkg := range tc.packages {
 					pkg.Licenses = sample.LicenseMetadata
-					m := sample.LegacyModule(modulePath, sample.VersionString)
+					m := sample.Module(modulePath, sample.VersionString)
 					sample.AddUnit(m, pkg)
 					if err := testDB.InsertModule(ctx, m); err != nil {
 						t.Fatal(err)
@@ -600,7 +600,7 @@
 	}
 
 	for path, m := range modules {
-		v := sample.LegacyModule(path, sample.VersionString, "p")
+		v := sample.Module(path, sample.VersionString, "p")
 		v.Packages()[0].IsRedistributable = m.redist
 		v.IsRedistributable = m.redist
 		v.HasGoMod = m.hasGoMod
@@ -637,7 +637,7 @@
 
 	// Insert a module with two packages.
 	const domain = "exclude.com"
-	sm := sample.LegacyModule(domain, "v1.2.3", "pkg", "ex/clude")
+	sm := sample.Module(domain, "v1.2.3", "pkg", "ex/clude")
 	if err := testDB.InsertModule(ctx, sm); err != nil {
 		t.Fatal(err)
 	}
@@ -758,7 +758,7 @@
 	}
 
 	insertModule := func(version string, gomod bool) {
-		m := sample.LegacyModule(sample.ModulePath, version, "A")
+		m := sample.Module(sample.ModulePath, version, "A")
 		m.HasGoMod = gomod
 		m.Packages()[0].Documentation.Synopsis = "syn-" + version
 		if err := testDB.InsertModule(ctx, m); err != nil {
@@ -803,7 +803,7 @@
 	defer cancel()
 
 	for _, hasGoMod := range []bool{true, false} {
-		m := sample.LegacyModule(fmt.Sprintf("foo.com/%t", hasGoMod), "v1.2.3", "bar")
+		m := sample.Module(fmt.Sprintf("foo.com/%t", hasGoMod), "v1.2.3", "bar")
 		m.HasGoMod = hasGoMod
 		if err := testDB.InsertModule(ctx, m); err != nil {
 			t.Fatal(err)
@@ -829,7 +829,7 @@
 	// insert package with suffix at version, return the module
 	insertPackageVersion := func(t *testing.T, suffix, version string, imports []string) *internal.Module {
 		t.Helper()
-		m := sample.LegacyModule("mod.com/"+suffix, version, suffix)
+		m := sample.Module("mod.com/"+suffix, version, suffix)
 		// Units[0] is the module itself.
 		pkg := m.Units[1]
 		pkg.Imports = nil
@@ -936,7 +936,7 @@
 
 		// Now we see an earlier version of that package, without a go.mod file, so we insert it.
 		// It should not get inserted into search_documents.
-		mAlt := sample.LegacyModule(alternativeModulePath, "v1.0.0", "A")
+		mAlt := sample.Module(alternativeModulePath, "v1.0.0", "A")
 		mAlt.Packages()[0].Imports = []string{"B"}
 		if err := testDB.InsertModule(ctx, mAlt); err != nil {
 			t.Fatal(err)
@@ -954,7 +954,7 @@
 	ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
 	defer cancel()
 
-	moduleA := sample.LegacyModule("mod.com", "v1.2.3",
+	moduleA := sample.Module("mod.com", "v1.2.3",
 		"A", "A/notinternal", "A/internal", "A/internal/B")
 
 	// moduleA.Units[1] is mod.com/A.
@@ -1098,7 +1098,7 @@
 		wantDeleted bool
 	}
 	insert := func(m module) {
-		sm := sample.LegacyModule(m.path, m.version, m.pkg)
+		sm := sample.Module(m.path, m.version, m.pkg)
 		if err := testDB.InsertModule(ctx, sm); err != nil {
 			t.Fatal(err)
 		}
diff --git a/internal/postgres/test_helper.go b/internal/postgres/test_helper.go
index 4760340..e090a8a 100644
--- a/internal/postgres/test_helper.go
+++ b/internal/postgres/test_helper.go
@@ -212,7 +212,7 @@
 			},
 		},
 	} {
-		m := sample.LegacyModule(data.modulePath, data.version, data.suffixes...)
+		m := sample.Module(data.modulePath, data.version, data.suffixes...)
 		if err := testDB.InsertModule(ctx, m); err != nil {
 			t.Fatal(err)
 		}
diff --git a/internal/postgres/unit_test.go b/internal/postgres/unit_test.go
index 377c08f..446c92c 100644
--- a/internal/postgres/unit_test.go
+++ b/internal/postgres/unit_test.go
@@ -28,7 +28,7 @@
 	InsertSampleDirectoryTree(ctx, t, testDB)
 
 	// Add a module that has READMEs in a directory and a package.
-	m := sample.LegacyModule("a.com/m", "v1.2.3", "dir/p")
+	m := sample.Module("a.com/m", "v1.2.3", "dir/p")
 	d := findDirectory(m, "a.com/m/dir")
 	d.Readme = &internal.Readme{
 		Filepath: "DIR_README.md",
@@ -211,7 +211,7 @@
 	defer ResetTestDB(testDB, t)
 
 	// Add a module that has READMEs in a directory and a package.
-	m := sample.LegacyModule("a.com/m", "v1.2.3", "dir/p")
+	m := sample.Module("a.com/m", "v1.2.3", "dir/p")
 	if err := testDB.InsertModule(ctx, m); err != nil {
 		t.Fatal(err)
 	}
diff --git a/internal/postgres/version_map_test.go b/internal/postgres/version_map_test.go
index 7f1529a..6869fcd 100644
--- a/internal/postgres/version_map_test.go
+++ b/internal/postgres/version_map_test.go
@@ -19,7 +19,7 @@
 	defer cancel()
 	defer ResetTestDB(testDB, t)
 
-	m := sample.LegacyModule("golang.org/x/tools", sample.VersionString, "go/packages")
+	m := sample.Module("golang.org/x/tools", sample.VersionString, "go/packages")
 	err := testDB.InsertModule(ctx, m)
 	if err != nil {
 		t.Fatal(err)
diff --git a/internal/postgres/version_test.go b/internal/postgres/version_test.go
index 5c07196..47b34ec 100644
--- a/internal/postgres/version_test.go
+++ b/internal/postgres/version_test.go
@@ -32,31 +32,31 @@
 		rootModule            = "golang.org/foo/bar"
 		nestedModule          = "golang.org/foo/bar/api"
 		testModules           = []*internal.Module{
-			sample.LegacyModule(stdlib.ModulePath, "v1.15.0-beta.1", "cmd/go"),
-			sample.LegacyModule(stdlib.ModulePath, "v1.14.6", "cmd/go"),
-			sample.LegacyModule(taggedModuleV3, "v3.2.0-beta", "bar"),
-			sample.LegacyModule(taggedModuleV3, "v3.2.0-alpha.2", "bar"),
-			sample.LegacyModule(taggedModuleV3, "v3.2.0-alpha.1", "bar"),
-			sample.LegacyModule(taggedModuleV3, "v3.1.0", "bar"),
-			sample.LegacyModule(taggedModuleV3, "v3.0.0", "bar"),
-			sample.LegacyModule(taggedModuleV2, "v2.0.1", "bar"),
-			sample.LegacyModule(taggedAndPseudoModule, "v1.5.3-pre1", "bar"),
-			sample.LegacyModule(taggedAndPseudoModule, "v1.5.2", "bar"),
-			sample.LegacyModule(taggedAndPseudoModule, "v0.0.0-20200101120000-000000000000", "bar"),
-			sample.LegacyModule(otherModule, "v3.0.0", "thing"),
-			sample.LegacyModule(incompatibleModule, "v2.0.0+incompatible", "module"),
-			sample.LegacyModule(incompatibleModule, "v0.0.0", "module"),
-			sample.LegacyModule(rootModule, "v1.0.3", "api"),
-			sample.LegacyModule(rootModule, "v0.11.6", "api"),
-			sample.LegacyModule(nestedModule, "v1.0.4", "api"),
-			sample.LegacyModule(nestedModule, "v1.0.3", "api"),
+			sample.Module(stdlib.ModulePath, "v1.15.0-beta.1", "cmd/go"),
+			sample.Module(stdlib.ModulePath, "v1.14.6", "cmd/go"),
+			sample.Module(taggedModuleV3, "v3.2.0-beta", "bar"),
+			sample.Module(taggedModuleV3, "v3.2.0-alpha.2", "bar"),
+			sample.Module(taggedModuleV3, "v3.2.0-alpha.1", "bar"),
+			sample.Module(taggedModuleV3, "v3.1.0", "bar"),
+			sample.Module(taggedModuleV3, "v3.0.0", "bar"),
+			sample.Module(taggedModuleV2, "v2.0.1", "bar"),
+			sample.Module(taggedAndPseudoModule, "v1.5.3-pre1", "bar"),
+			sample.Module(taggedAndPseudoModule, "v1.5.2", "bar"),
+			sample.Module(taggedAndPseudoModule, "v0.0.0-20200101120000-000000000000", "bar"),
+			sample.Module(otherModule, "v3.0.0", "thing"),
+			sample.Module(incompatibleModule, "v2.0.0+incompatible", "module"),
+			sample.Module(incompatibleModule, "v0.0.0", "module"),
+			sample.Module(rootModule, "v1.0.3", "api"),
+			sample.Module(rootModule, "v0.11.6", "api"),
+			sample.Module(nestedModule, "v1.0.4", "api"),
+			sample.Module(nestedModule, "v1.0.3", "api"),
 		}
 	)
 
 	// Add 12 pseudo versions to the test modules. Below we only
 	// expect to return the 10 most recent.
 	for i := 1; i <= 12; i++ {
-		testModules = append(testModules, sample.LegacyModule(pseudoModule, fmt.Sprintf("v0.0.0-202001011200%02d-000000000000", i), "blog"))
+		testModules = append(testModules, sample.Module(pseudoModule, fmt.Sprintf("v0.0.0-202001011200%02d-000000000000", i), "blog"))
 	}
 
 	defer ResetTestDB(testDB, t)
@@ -241,7 +241,7 @@
 		"foo.com/bar/v3",
 		"bar.com/foo",
 	} {
-		m := sample.LegacyModule(modulePath, sample.VersionString, sample.Suffix)
+		m := sample.Module(modulePath, sample.VersionString, sample.Suffix)
 		if err := testDB.InsertModule(ctx, m); err != nil {
 			t.Fatal(err)
 		}
diff --git a/internal/testing/sample/legacy.go b/internal/testing/sample/legacy.go
index 27e4ce1..105f5ba 100644
--- a/internal/testing/sample/legacy.go
+++ b/internal/testing/sample/legacy.go
@@ -14,12 +14,12 @@
 
 func LegacyDefaultModule() *internal.Module {
 	fp := constructFullPath(ModulePath, Suffix)
-	return AddPackage(LegacyModule(ModulePath, VersionString), UnitForPackage(fp, ModulePath, VersionString, path.Base(fp), true))
+	return AddPackage(Module(ModulePath, VersionString), UnitForPackage(fp, ModulePath, VersionString, path.Base(fp), true))
 }
 
-// LegacyModule creates a Module with the given path and version.
+// Module creates a Module with the given path and version.
 // The list of suffixes is used to create Units within the module.
-func LegacyModule(modulePath, version string, suffixes ...string) *internal.Module {
+func Module(modulePath, version string, suffixes ...string) *internal.Module {
 	mi := ModuleInfo(modulePath, version)
 	m := &internal.Module{
 		ModuleInfo: *mi,
diff --git a/internal/worker/completion_test.go b/internal/worker/completion_test.go
index 6eaa4c0..11489b6 100644
--- a/internal/worker/completion_test.go
+++ b/internal/worker/completion_test.go
@@ -29,8 +29,8 @@
 	// package in v2 imports the package in v1. By setting our 'popular cutoff'
 	// to 1, we can force the package in v1 to be considered popular.
 	rc := redis.NewClient(&redis.Options{Addr: mr.Addr()})
-	m1 := sample.LegacyModule("github.com/something", sample.VersionString, "apples/bananas")
-	m2 := sample.LegacyModule("github.com/something/else", sample.VersionString, "oranges/bananas")
+	m1 := sample.Module("github.com/something", sample.VersionString, "apples/bananas")
+	m2 := sample.Module("github.com/something/else", sample.VersionString, "oranges/bananas")
 	m2.Units[1].Imports = []string{m1.Units[1].Path}
 	if err := testDB.InsertModule(ctx, m1); err != nil {
 		t.Fatal(err)