Copyright 2021 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

package internal

import (
	
	

	
	
)
SymbolSection is the documentation section where a symbol appears.
SymbolKind is the type of a symbol.
Symbol is an element in the package API. A symbol can be a constant, variable, function, or type.
type Symbol struct {
	SymbolMeta
Children contain the child symbols for this symbol. This will only be populated when the SymbolType is "Type". For example, the children of net/http.Handler are FileServer, NotFoundHandler, RedirectHandler, StripPrefix, and TimeoutHandler. Each child symbol will have ParentName set to the Name of this type.
GOOS specifies the execution operating system where the symbol appears.
GOARCH specifies the execution architecture where the symbol appears.
SymbolMeta is the metadata for an element in the package API. A symbol can be a constant, variable, function, or type.
Name is the name of the symbol.
Synopsis is the one line description of the symbol as displayed in the package documentation.
Section is the section that a symbol appears in.
Kind is the type of a symbol, which is either a constant, variable, function, type, field or method.
ParentName if name of the parent type if available, otherwise the empty string. For example, the parent type for net/http.FileServer is Handler.
SymbolHistory represents the history for when a symbol name was first added to a package.
m is a map of version to name to SymbolMeta to UnitSymbol. SymbolMeta is stored as a distinct key from name, since it is possible for a symbol in the same version for different build contexts to have different SymbolMeta. For example: https://pkg.go.dev/syscall@go1.16.3#CloseOnExec has function signature: func CloseOnExec(fd int) versus https://pkg.go.dev/syscall?GOOS=windows#CloseOnExec has function signature: func CloseOnExec(fd Handle)
NewSymbolHistory returns a new *SymbolHistory.
SymbolsAtVersion returns a map of name to SymbolMeta to UnitSymbol for a given version.
Versions returns an array of the versions in versionToNameToUnitSymbol, sorted by increasing semver.
func ( *SymbolHistory) () []string {
	var  []string
	for  := range .m {
		 = append(, )
	}
	sort.Slice(, func(,  int) bool {
		return semver.Compare([], []) == -1
	})
	return 
}
GetSymbol returns the unit symbol for a given name, version and build context.
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", , , )
}
AddSymbol adds the given symbol to SymbolHistory.
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()
}
SymbolBuildContexts represents the build contexts that are associated with a SymbolMeta.
builds are the build contexts that apply to this symbol.
BuildContexts returns the build contexts for this UnitSymbol.
func ( *SymbolBuildContexts) () []BuildContext {
	var  []BuildContext
	for  := range .builds {
		 = append(, )
	}
	sort.Slice(, func(,  int) bool {
		return [].GOOS < [].GOOS
	})
	return 
}
AddBuildContext adds a build context supported by this UnitSymbol.
func ( *SymbolBuildContexts) ( BuildContext) {
	if .builds == nil {
		.builds = map[BuildContext]bool{}
	}
	if  != BuildContextAll {
		.builds[] = true
		return
	}
	for ,  := range BuildContexts {
		.builds[] = true
	}
}
SupportsBuild reports whether the provided build is supported by this UnitSymbol. If the build is BuildContextAll, this is interpreted as this unit symbol supports at least one build context.
func ( *SymbolBuildContexts) ( BuildContext) bool {
	if  == BuildContextAll {
		return len(.builds) > 0
	}
	return .builds[]
}
InAll reports whether the unit symbol supports all build contexts.
func ( *SymbolBuildContexts) () bool {
	return len(.builds) == len(BuildContexts)
}
RemoveBuildContexts removes all of the build contexts associated with this unit symbol.