func (r *callersResult) toSerial(res *serial.Result, fset *token.FileSet) { var callers []serial.Caller for _, edge := range r.edges { callers = append(callers, serial.Caller{ Caller: edge.Caller.Func.String(), Pos: fset.Position(edge.Pos()).String(), Desc: edge.Description(), }) } res.Callers = callers }
func (r *callersResult) toSerial(res *serial.Result, fset *token.FileSet) { root := r.callgraph.Root() var callers []serial.Caller for _, edge := range r.edges { var c serial.Caller c.Caller = edge.Caller.Func().String() if edge.Caller == root { c.Desc = "synthetic call" } else { c.Pos = fset.Position(edge.Site.Pos()).String() c.Desc = edge.Site.Common().Description() } callers = append(callers, c) } res.Callers = callers }