aboutsummaryrefslogtreecommitdiff
path: root/internal/testing/sample
diff options
context:
space:
mode:
authorJulie Qiu <julie@golang.org>2020-07-10 00:29:42 -0400
committerJulie Qiu <julie@golang.org>2020-07-10 17:32:36 +0000
commit7279dbeffaab752db47ed69e801d207b24134b3a (patch)
treecc02315a7dd4fbef07adc4c44a6c5c5d55c50819 /internal/testing/sample
parent89dd2f627b28fa51cefc382524afb6f29cf494e3 (diff)
downloadgo-x-pkgsite-7279dbeffaab752db47ed69e801d207b24134b3a.tar.xz
internal: remove New suffix from structs
The New suffix is removed from PackageNew and DirectoryNew, since the legacy methods are already prefixed with "Legacy". For golang/go#39629 Change-Id: I8be32310c6b451035021663000aac6ca845ee6e0 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/241900 Reviewed-by: Jonathan Amsterdam <jba@google.com>
Diffstat (limited to 'internal/testing/sample')
-rw-r--r--internal/testing/sample/sample.go22
1 files changed, 11 insertions, 11 deletions
diff --git a/internal/testing/sample/sample.go b/internal/testing/sample/sample.go
index dacacd0a..dac5b4f9 100644
--- a/internal/testing/sample/sample.go
+++ b/internal/testing/sample/sample.go
@@ -199,7 +199,7 @@ func Module(modulePath, version string, suffixes ...string) *internal.Module {
if emptySuffix {
AddPackage(m, LegacyPackage(modulePath, ""))
} else {
- m.Directories = []*internal.DirectoryNew{DirectoryNewForModuleRoot(mi, LicenseMetadata)}
+ m.Directories = []*internal.Directory{DirectoryForModuleRoot(mi, LicenseMetadata)}
}
for _, s := range suffixes {
if s != "" {
@@ -215,7 +215,7 @@ func AddPackage(m *internal.Module, p *internal.LegacyPackage) *internal.Module
p.Path, m.ModulePath))
}
m.LegacyPackages = append(m.LegacyPackages, p)
- AddDirectory(m, DirectoryNewForPackage(p))
+ AddDirectory(m, DirectoryForPackage(p))
minLen := len(m.ModulePath)
if m.ModulePath == stdlib.ModulePath {
minLen = 1
@@ -229,13 +229,13 @@ func AddPackage(m *internal.Module, p *internal.LegacyPackage) *internal.Module
}
}
if !found {
- AddDirectory(m, DirectoryNewEmpty(pth))
+ AddDirectory(m, DirectoryEmpty(pth))
}
}
return m
}
-func AddDirectory(m *internal.Module, d *internal.DirectoryNew) {
+func AddDirectory(m *internal.Module, d *internal.Directory) {
for _, e := range m.Directories {
if e.Path == d.Path {
panic(fmt.Sprintf("module already has path %q", e.Path))
@@ -244,8 +244,8 @@ func AddDirectory(m *internal.Module, d *internal.DirectoryNew) {
m.Directories = append(m.Directories, d)
}
-func DirectoryNewEmpty(path string) *internal.DirectoryNew {
- return &internal.DirectoryNew{
+func DirectoryEmpty(path string) *internal.Directory {
+ return &internal.Directory{
DirectoryMeta: internal.DirectoryMeta{
Path: path,
IsRedistributable: true,
@@ -255,8 +255,8 @@ func DirectoryNewEmpty(path string) *internal.DirectoryNew {
}
}
-func DirectoryNewForModuleRoot(m *internal.LegacyModuleInfo, licenses []*licenses.Metadata) *internal.DirectoryNew {
- d := &internal.DirectoryNew{
+func DirectoryForModuleRoot(m *internal.LegacyModuleInfo, licenses []*licenses.Metadata) *internal.Directory {
+ d := &internal.Directory{
DirectoryMeta: internal.DirectoryMeta{
Path: m.ModulePath,
IsRedistributable: m.IsRedistributable,
@@ -273,15 +273,15 @@ func DirectoryNewForModuleRoot(m *internal.LegacyModuleInfo, licenses []*license
return d
}
-func DirectoryNewForPackage(pkg *internal.LegacyPackage) *internal.DirectoryNew {
- return &internal.DirectoryNew{
+func DirectoryForPackage(pkg *internal.LegacyPackage) *internal.Directory {
+ return &internal.Directory{
DirectoryMeta: internal.DirectoryMeta{
Path: pkg.Path,
IsRedistributable: pkg.IsRedistributable,
Licenses: pkg.Licenses,
V1Path: pkg.V1Path,
},
- Package: &internal.PackageNew{
+ Package: &internal.Package{
Name: pkg.Name,
Path: pkg.Path,
Imports: pkg.Imports,