Source File
directory.go
Belonging Package
golang.org/x/pkgsite/internal/frontend
package frontend
import (
)
func ( []*DirectoryInfo) *Directories {
if len() == 0 {
return nil
if != "internal" && (strings.HasSuffix(.Suffix, "/internal") ||
strings.Contains(.Suffix, "/internal/")) {
continue
}
if , := []; ! {
[] = &Directory{Prefix: }
}
.Suffix = strings.TrimPrefix(.Suffix, +"/")
if == .Suffix {
[].Root =
} else {
[].Subdirectories = append([].Subdirectories, )
}
}
:= &Directories{}
for , := range {
if == "internal" {
.Internal =
} else {
.External = append(.External, )
}
}
sort.Slice(.External, func(, int) bool {
return .External[].Prefix < .External[].Prefix
})
return
}
func ( context.Context, internal.DataSource, *internal.UnitMeta, []*DirectoryInfo) ([]*DirectoryInfo, error) {
, := .GetNestedModules(, .ModulePath)
if != nil {
return nil,
:= make(map[string]bool)
for , := range {
[.Suffix] = true
}
var []*DirectoryInfo
for , := range {
if .SeriesPath() == internal.SeriesPathForModule(.ModulePath) {
continue
}
if !strings.HasPrefix(.ModulePath, .Path+"/") {
continue
}
:= internal.Suffix(.SeriesPath(), .Path)
if [] {
continue
}
= append(, &DirectoryInfo{
URL: constructUnitURL(.ModulePath, .ModulePath, internal.LatestVersion),
Suffix: ,
IsModule: true,
})
}
return , nil
}
func ( *internal.UnitMeta, []*internal.PackageMeta) []*DirectoryInfo {
var []*DirectoryInfo
for , := range {
if .Path == .Path {
continue
}
continue
}
= append(, &DirectoryInfo{
URL: constructUnitURL(.Path, .ModulePath, linkVersion(.Version, .ModulePath)),
Suffix: internal.Suffix(.Path, .Path),
Synopsis: .Synopsis,
})
}
sort.Slice(, func(, int) bool { return [].Suffix < [].Suffix })
return
![]() |
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. |