Source File
header.go
Belonging Package
golang.org/x/pkgsite/internal/frontend
package frontend
import (
)
const (
pageTypeModule = "module"
pageTypeDirectory = "directory"
pageTypePackage = "package"
pageTypeCommand = "command"
pageTypeModuleStd = "std"
pageTypeStdlib = "standard library"
)
func ( *internal.UnitMeta) string {
switch {
case .Path == stdlib.ModulePath:
return "Standard library"
case .IsCommand():
return effectiveName(.Path, .Name)
case .IsPackage():
return .Name
case .IsModule():
, , := module.SplitPathVersion(.Path)
return path.Base()
default:
return path.Base(.Path) + "/"
}
}
func ( *internal.UnitMeta) string {
if .Path == stdlib.ModulePath {
return pageTypeModuleStd
}
if .IsCommand() {
return pageTypeCommand
}
if .IsPackage() {
return pageTypePackage
}
if .IsModule() {
return pageTypeModule
}
return pageTypeDirectory
}
func ( *internal.UnitMeta) []string {
var []string
if .Path == stdlib.ModulePath {
return nil
}
if .IsCommand() {
= append(, pageTypeCommand)
} else if .IsPackage() {
= append(, pageTypePackage)
}
if .IsModule() {
= append(, pageTypeModule)
}
if !.IsPackage() && !.IsModule() {
= append(, pageTypeDirectory)
}
if stdlib.Contains(.Path) {
= append(, pageTypeStdlib)
}
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. |