@@ -20,7 +20,6 @@ import (
20
20
"golang.org/x/pkgsite/internal"
21
21
"golang.org/x/pkgsite/internal/derrors"
22
22
"golang.org/x/pkgsite/internal/fetch"
23
- "golang.org/x/pkgsite/internal/licenses"
24
23
"golang.org/x/pkgsite/internal/proxy"
25
24
"golang.org/x/pkgsite/internal/source"
26
25
"golang.org/x/pkgsite/internal/stdlib"
@@ -78,60 +77,6 @@ type versionEntry struct {
78
77
err error
79
78
}
80
79
81
- // GetDirectory returns information about a directory at a path.
82
- func (ds * DataSource ) GetDirectory (ctx context.Context , fullPath , modulePath , version string ) (_ * internal.Directory , err error ) {
83
- defer derrors .Wrap (& err , "GetDirectory(%q, %q, %q)" , fullPath , modulePath , version )
84
- return ds .directoryFromVersion (ctx , fullPath , modulePath , version )
85
- }
86
-
87
- // GetImports returns package imports as extracted from the module zip.
88
- func (ds * DataSource ) GetImports (ctx context.Context , pkgPath , modulePath , version string ) (_ []string , err error ) {
89
- defer derrors .Wrap (& err , "GetImports(%q, %q, %q)" , pkgPath , modulePath , version )
90
- vp , err := ds .LegacyGetPackage (ctx , pkgPath , modulePath , version )
91
- if err != nil {
92
- return nil , err
93
- }
94
- return vp .Imports , nil
95
- }
96
-
97
- // GetLicenses return licenses at path for the given module path and version.
98
- func (ds * DataSource ) GetLicenses (ctx context.Context , fullPath , modulePath , resolvedVersion string ) (_ []* licenses.License , err error ) {
99
- defer derrors .Wrap (& err , "GetLicenses(%q, %q, %q)" , fullPath , modulePath , resolvedVersion )
100
- v , err := ds .getModule (ctx , modulePath , resolvedVersion )
101
- if err != nil {
102
- return nil , err
103
- }
104
-
105
- var lics []* licenses.License
106
-
107
- // ds.getModule() returns all licenses for the module version. We need to
108
- // filter the licenses that applies to the specified fullPath, i.e.
109
- // A license in the current or any parent directory of the specified
110
- // fullPath applies to it.
111
- for _ , license := range v .Licenses {
112
- licensePath := path .Join (modulePath , path .Dir (license .FilePath ))
113
- if strings .HasPrefix (fullPath , licensePath ) {
114
- lics = append (lics , license )
115
- }
116
- }
117
-
118
- if len (lics ) == 0 {
119
- return nil , fmt .Errorf ("path %s is missing from module %s: %w" , fullPath , modulePath , derrors .NotFound )
120
- }
121
- return lics , nil
122
- }
123
-
124
- // GetModuleInfo returns the ModuleInfo as fetched from the proxy for module
125
- // version specified by modulePath and version.
126
- func (ds * DataSource ) GetModuleInfo (ctx context.Context , modulePath , version string ) (_ * internal.ModuleInfo , err error ) {
127
- defer derrors .Wrap (& err , "GetModuleInfo(%q, %q)" , modulePath , version )
128
- m , err := ds .getModule (ctx , modulePath , version )
129
- if err != nil {
130
- return nil , err
131
- }
132
- return & m .ModuleInfo , nil
133
- }
134
-
135
80
// getModule retrieves a version from the cache, or failing that queries and
136
81
// processes the version from the proxy.
137
82
func (ds * DataSource ) getModule (ctx context.Context , modulePath , version string ) (_ * internal.Module , err error ) {
@@ -320,47 +265,6 @@ func packageFromVersion(pkgPath string, m *internal.Module) (_ *internal.LegacyV
320
265
return nil , fmt .Errorf ("package missing from module %s: %w" , m .ModulePath , derrors .NotFound )
321
266
}
322
267
323
- // GetExperiments is unimplemented.
324
- func (* DataSource ) GetExperiments (ctx context.Context ) ([]* internal.Experiment , error ) {
325
- return nil , nil
326
- }
327
-
328
- // GetPathInfo returns information about the given path.
329
- func (ds * DataSource ) GetPathInfo (ctx context.Context , path , inModulePath , inVersion string ) (outModulePath , outVersion string , isPackage bool , err error ) {
330
- defer derrors .Wrap (& err , "GetPathInfo(%q, %q, %q)" , path , inModulePath , inVersion )
331
-
332
- var info * proxy.VersionInfo
333
- if inModulePath == internal .UnknownModulePath {
334
- inModulePath , info , err = ds .findModule (ctx , path , inVersion )
335
- if err != nil {
336
- return "" , "" , false , err
337
- }
338
- inVersion = info .Version
339
- }
340
- m , err := ds .getModule (ctx , inModulePath , inVersion )
341
- if err != nil {
342
- return "" , "" , false , err
343
- }
344
- isPackage = false
345
- for _ , p := range m .LegacyPackages {
346
- if p .Path == path {
347
- isPackage = true
348
- break
349
- }
350
- }
351
- return m .ModulePath , m .Version , isPackage , nil
352
- }
353
-
354
- // GetDirectoryMeta returns information about a directory at a path.
355
- func (ds * DataSource ) GetDirectoryMeta (ctx context.Context , fullPath , modulePath , version string ) (_ * internal.DirectoryMeta , err error ) {
356
- defer derrors .Wrap (& err , "GetDirectoryMeta(%q, %q, %q)" , fullPath , modulePath , version )
357
- d , err := ds .directoryFromVersion (ctx , fullPath , modulePath , version )
358
- if err != nil {
359
- return nil , err
360
- }
361
- return & d .DirectoryMeta , nil
362
- }
363
-
364
268
// directoryFromVersion returns information about a directory at a path.
365
269
func (ds * DataSource ) directoryFromVersion (ctx context.Context , fullPath , modulePath , version string ) (_ * internal.Directory , err error ) {
366
270
var m * internal.Module
0 commit comments