golang static callgrap, wrap of golang/tools/cmd/callgraph
callgraph [-algo=static|cha|rta|pta] [-test] [-format=...] package ...
- 提供golang某个包(或者指定包)的静态函数的函数函数调用关系
- 可指定输出的格式,默认格式支持go/cmd/digraph的查询使用
- Caller 调用函数, 类型ssa.Function
- Callee 被调用函数,类型ssa.function
- Filename 函数名(包含package的路径)
- Offset 该函数在文件里的位置偏移
- Line 第几行
- Column 第几列
- Dynamic "static" or "dynamic",暂时不知道这个信息的意义
- Description 函数的描述信息
- Pkg 函数所在package的结构,类型ssa.Package
- Prog 函数被编译时所在的程序,类型ssa.Program
- Param 函数的参数,类型ssa.Parameter的数组
……更多的参数查看 golang.org/x/tools/go/ssa 的Function信息
nodes
the set of all nodes
degree
the in-degree and out-degree of each node
transpose
the reverse of the input edges
preds <node> ...
the set of immediate predecessors of the specified nodes
succs <node> ...
the set of immediate successors of the specified nodes
forward <node> ...
the set of nodes transitively reachable from the specified nodes
reverse <node> ...
the set of nodes that transitively reach the specified nodes
somepath <node> <node>
the list of nodes on some arbitrary path from the first node to the second
allpaths <node> <node>
the set of nodes on all paths from the first node to the second
sccs
all strongly connected components (one per line)
scc <node>
the set of nodes nodes strongly connected to the specified one