зеркало из https://github.com/golang/pkgsite.git
internal: rename GetPackagesInModule to LegacyGetPackagesInModule
Change-Id: I64cada2235d68a1b3fb75b6ba73a921beb7f81f4 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/238027 Reviewed-by: Jonathan Amsterdam <jba@google.com>
This commit is contained in:
Родитель
ce3e896dfe
Коммит
b26ac09579
|
@ -59,5 +59,5 @@ type DataSource interface {
|
|||
LegacyGetPackageLicenses(ctx context.Context, pkgPath, modulePath, version string) ([]*licenses.License, error)
|
||||
// GetPackagesInModule returns LegacyPackages contained in the module version
|
||||
// specified by modulePath and version.
|
||||
GetPackagesInModule(ctx context.Context, modulePath, version string) ([]*LegacyPackage, error)
|
||||
LegacyGetPackagesInModule(ctx context.Context, modulePath, version string) ([]*LegacyPackage, error)
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ func fetchDirectoryDetails(ctx context.Context, ds internal.DataSource, dirPath
|
|||
}
|
||||
|
||||
if dirPath == stdlib.ModulePath {
|
||||
pkgs, err := ds.GetPackagesInModule(ctx, stdlib.ModulePath, mi.Version)
|
||||
pkgs, err := ds.LegacyGetPackagesInModule(ctx, stdlib.ModulePath, mi.Version)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -20,10 +20,10 @@ import (
|
|||
"golang.org/x/pkgsite/internal/version"
|
||||
)
|
||||
|
||||
// GetPackagesInModule returns packages contained in the module version
|
||||
// LegacyGetPackagesInModule returns packages contained in the module version
|
||||
// specified by modulePath and version. The returned packages will be sorted
|
||||
// by their package path.
|
||||
func (db *DB) GetPackagesInModule(ctx context.Context, modulePath, version string) (_ []*internal.LegacyPackage, err error) {
|
||||
func (db *DB) LegacyGetPackagesInModule(ctx context.Context, modulePath, version string) (_ []*internal.LegacyPackage, err error) {
|
||||
query := `SELECT
|
||||
path,
|
||||
name,
|
||||
|
@ -63,7 +63,7 @@ func (db *DB) GetPackagesInModule(ctx context.Context, modulePath, version strin
|
|||
}
|
||||
|
||||
if err := db.db.RunQuery(ctx, query, collect, modulePath, version); err != nil {
|
||||
return nil, fmt.Errorf("DB.GetPackagesInModule(ctx, %q, %q): %w", modulePath, version, err)
|
||||
return nil, fmt.Errorf("DB.LegacyGetPackagesInModule(ctx, %q, %q): %w", modulePath, version, err)
|
||||
}
|
||||
return packages, nil
|
||||
}
|
||||
|
|
|
@ -335,7 +335,7 @@ func TestGetPackagesInVersion(t *testing.T) {
|
|||
t.Error(err)
|
||||
}
|
||||
|
||||
got, err := testDB.GetPackagesInModule(ctx, tc.pkgPath, tc.module.Version)
|
||||
got, err := testDB.LegacyGetPackagesInModule(ctx, tc.pkgPath, tc.module.Version)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -634,7 +634,7 @@ func (db *DB) compareLicenses(ctx context.Context, m *internal.Module) (err erro
|
|||
// are packages in the packages table that are not present in m.LegacyPackages.
|
||||
func (db *DB) comparePackages(ctx context.Context, m *internal.Module) (err error) {
|
||||
defer derrors.Wrap(&err, "comparePackages(ctx, %q, %q)", m.ModulePath, m.Version)
|
||||
dbPackages, err := db.GetPackagesInModule(ctx, m.ModulePath, m.Version)
|
||||
dbPackages, err := db.LegacyGetPackagesInModule(ctx, m.ModulePath, m.Version)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -176,9 +176,9 @@ func (ds *DataSource) LegacyGetPackageLicenses(ctx context.Context, pkgPath, mod
|
|||
return nil, fmt.Errorf("package %s is missing from module %s: %w", pkgPath, modulePath, derrors.NotFound)
|
||||
}
|
||||
|
||||
// GetPackagesInModule returns LegacyPackages contained in the module zip corresponding to modulePath and version.
|
||||
func (ds *DataSource) GetPackagesInModule(ctx context.Context, modulePath, version string) (_ []*internal.LegacyPackage, err error) {
|
||||
defer derrors.Wrap(&err, "GetPackagesInModule(%q, %q)", modulePath, version)
|
||||
// LegacyGetPackagesInModule returns LegacyPackages contained in the module zip corresponding to modulePath and version.
|
||||
func (ds *DataSource) LegacyGetPackagesInModule(ctx context.Context, modulePath, version string) (_ []*internal.LegacyPackage, err error) {
|
||||
defer derrors.Wrap(&err, "LegacyGetPackagesInModule(%q, %q)", modulePath, version)
|
||||
v, err := ds.getModule(ctx, modulePath, version)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -173,7 +173,7 @@ func TestDataSource_LegacyGetPackageLicenses(t *testing.T) {
|
|||
func TestDataSource_GetPackagesInVersion(t *testing.T) {
|
||||
ctx, ds, teardown := setup(t)
|
||||
defer teardown()
|
||||
got, err := ds.GetPackagesInModule(ctx, "foo.com/bar", "v1.2.0")
|
||||
got, err := ds.LegacyGetPackagesInModule(ctx, "foo.com/bar", "v1.2.0")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче