A Result holds the results of Rapid Type Analysis, which includes the set of reachable functions/methods, runtime types, and the call graph.
type Result struct {
// CallGraph is the discovered callgraph.
// It does not include edges for calls made via reflection.
CallGraph *callgraph.Graph
// Reachable contains the set of reachable functions and methods.
// This includes exported methods of runtime types, since
// they may be accessed via reflection.
// The value indicates whether the function is address-taken.
//
// (We wrap the bool in a struct to avoid inadvertent use of
// "if Reachable[f] {" to test for set membership.)
Reachable map[*ssa.Function]struct{ AddrTaken bool }
// RuntimeTypes contains the set of types that are needed at
// runtime, for interfaces or reflection.
//
// The value indicates whether the type is inaccessible to reflection.
// Consider:
// type A struct{B}
// fmt.Println(new(A))
// Types *A, A and B are accessible to reflection, but the unnamed
// type struct{B} is not.
RuntimeTypes typeutil.Map
}
func Analyze(roots []*ssa.Function, buildCallGraph bool) *Result
Analyze performs Rapid Type Analysis, starting at the specified root functions. It returns nil if no roots were specified.
If buildCallGraph is true, Result.CallGraph will contain a call graph; otherwise, only the other fields (reachable functions) are populated.