Source File
imports.go
Belonging Package
golang.org/x/pkgsite/internal/frontend
package frontend
import (
)
type ImportsDetails struct {
ModulePath string
func ( context.Context, internal.DataSource, , , string) ( *ImportsDetails, error) {
, := .GetUnit(, &internal.UnitMeta{
Path: ,
ModuleInfo: internal.ModuleInfo{
ModulePath: ,
Version: ,
},
}, internal.WithImports, internal.BuildContext{})
if != nil {
return nil,
}
var , , []string
for , := range .Imports {
if stdlib.Contains() {
= append(, )
} else if strings.HasPrefix(+"/", +"/") {
= append(, )
} else {
= append(, )
}
}
return &ImportsDetails{
ModulePath: ,
ExternalImports: ,
InternalImports: ,
StdLib: ,
}, nil
}
importedByLimit = 20001
)
func ( context.Context, internal.DataSource, , string) (*ImportedByDetails, error) {
, := .(*postgres.DB)
return nil, proxydatasourceNotSupportedErr()
}
, := .GetImportedBy(, , , importedByLimit)
if != nil {
return nil,
}
:= len()
, := .GetImportedByCount(, , )
if != nil {
return nil,
}
log.Errorf(, "search_documents.num_imported_by > numImportedBy from imports unique, which shouldn't happen: %d", )
}
if >= importedByLimit {
= [:importedByLimit-1]
}
:= Sections(, nextPrefixAccount)
var (
string
= "package"
)
if > 1 {
= "packages"
}
case >= importedByLimit && > :
case >= importedByLimit:
case > :
default:
= strconv.Itoa()
}
return &ImportedByDetails{
ModulePath: ,
ImportedBy: ,
NumImportedByDisplay: ,
Total: ,
}, nil
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |