Source File
symbol.go
Belonging Package
golang.org/x/pkgsite/internal
package internal
import (
)
type SymbolSection string
const (
SymbolSectionConstants SymbolSection = "Constants"
SymbolSectionVariables SymbolSection = "Variables"
SymbolSectionFunctions SymbolSection = "Functions"
SymbolSectionTypes SymbolSection = "Types"
)
type SymbolKind string
const (
SymbolKindConstant SymbolKind = "Constant"
SymbolKindVariable SymbolKind = "Variable"
SymbolKindFunction SymbolKind = "Function"
SymbolKindType SymbolKind = "Type"
SymbolKindField SymbolKind = "Field"
SymbolKindMethod SymbolKind = "Method"
)
type Symbol struct {
SymbolMeta
m map[string]map[string]map[SymbolMeta]*SymbolBuildContexts
}
func () *SymbolHistory {
return &SymbolHistory{
m: map[string]map[string]map[SymbolMeta]*SymbolBuildContexts{},
}
}
func ( *SymbolHistory) ( string) map[string]map[SymbolMeta]*SymbolBuildContexts {
return .m[]
}
func ( *SymbolHistory) (, string, BuildContext) ( *SymbolMeta, error) {
defer derrors.Wrap(&, "GetSymbol(%q, %q, %v)", , , )
, := .m[]
if ! {
return nil, fmt.Errorf("version %q could not be found: %q", , )
}
, := []
if ! {
return nil, fmt.Errorf("symbol %q could not be found at version %q", , )
}
for , := range {
if .SupportsBuild() {
return &, nil
}
}
return nil, fmt.Errorf("symbol %q does not have build %v at version %q", , , )
}
func ( *SymbolHistory) ( SymbolMeta, string, BuildContext) {
if == "v1.10.0" && (.Name == "FD" || .ParentName == "FD") {
fmt.Println(, , .Name, .Synopsis)
}
, := .m[]
if ! {
= map[string]map[SymbolMeta]*SymbolBuildContexts{}
.m[] =
}
, := [.Name]
if ! {
= map[SymbolMeta]*SymbolBuildContexts{}
.m[][.Name] =
}
, := []
if ! {
= &SymbolBuildContexts{}
.m[][.Name][] =
}
.AddBuildContext()
}
builds map[BuildContext]bool
}
func ( *SymbolBuildContexts) () []BuildContext {
var []BuildContext
for := range .builds {
= append(, )
}
sort.Slice(, func(, int) bool {
return [].GOOS < [].GOOS
})
return
}
func ( *SymbolBuildContexts) ( BuildContext) {
if .builds == nil {
.builds = map[BuildContext]bool{}
}
if != BuildContextAll {
.builds[] = true
return
}
for , := range BuildContexts {
.builds[] = true
}
}
func ( *SymbolBuildContexts) ( BuildContext) bool {
if == BuildContextAll {
return len(.builds) > 0
}
return .builds[]
}
func ( *SymbolBuildContexts) () bool {
return len(.builds) == len(BuildContexts)
}
func ( *SymbolBuildContexts) () {
.builds = map[BuildContext]bool{}
![]() |
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. |