Package analysis
Overview ▹
Index ▹
func Run ¶
func Run(pta bool, result *Result)
Run runs program analysis and computes the resulting markup, populating *result in a thread-safe manner, first with type information then later with pointer analysis information if enabled by the pta flag.
type FileInfo ¶
FileInfo holds analysis information for the source file view. Clients must not mutate it.
type FileInfo struct { Data []interface{} // JSON serializable values Links []Link // HTML link markup }
type Link ¶
A Link is an HTML decoration of the bytes [Start, End) of a file. Write is called before/after those bytes to emit the mark-up.
type Link interface {
Start() int
End() int
Write(w io.Writer, _ int, start bool) // the godoc.LinkWriter signature
}
type PCGNodeJSON ¶
JavaScript's cgAddChild requires a global array of PCGNodeJSON called CALLGRAPH, representing the intra-package call graph. The first element is special and represents "all external callers".
type PCGNodeJSON struct {
Func anchorJSON
Callees []int // indices within CALLGRAPH of nodes called by this one
}
type PackageInfo ¶
PackageInfo holds analysis information for the package view. Clients must not mutate it.
type PackageInfo struct { CallGraph []*PCGNodeJSON CallGraphIndex map[string]int Types []*TypeInfoJSON }
type Result ¶
Result contains the results of analysis. The result contains a mapping from filenames to a set of HTML links and JavaScript data referenced by the links.
type Result struct {
// contains filtered or unexported fields
}
func (*Result) FileInfo ¶
func (res *Result) FileInfo(url string) (fi FileInfo)
FileInfo returns new slices containing opaque JSON values and the HTML link markup for the specified godoc file URL. Thread-safe. Callers must not mutate the elements. It returns "zero" if no data is available.
func (*Result) PackageInfo ¶
func (res *Result) PackageInfo(importPath string) PackageInfo
PackageInfo returns new slices of JSON values for the callgraph and type info for the specified package. Thread-safe. Callers must not mutate its fields. PackageInfo returns "zero" if no data is available.
func (*Result) Status ¶
func (res *Result) Status() string
Status returns a human-readable description of the current analysis status.
type TypeInfoJSON ¶
JavaScript's onClickIdent() expects a TypeInfoJSON.
type TypeInfoJSON struct {
Name string // type name
Size, Align int64
Methods []anchorJSON
ImplGroups []implGroupJSON
}