Re: [go-nuts] adding context.Context to new code

2017-05-18 Thread Nazri Ramliy
On Wed, May 17, 2017 at 3:55 PM, Nazri Ramliy <ayieh...@gmail.com> wrote:
> I'm about to embark on doing the same, and my first pit stop is at
> using the callgraph to generate the caller-callee data but stumbled
> upon this error while trying out the example given by the "callgraph"
> command when run without arguments:
>
> $ callgraph -format '{{.Caller.Pkg.Object.Path}} ->
> {{.Callee.Pkg.Object.Path}}' /usr/local/go/src/net/http/triv.go | sort
> | uniq
> callgraph: template: -format:1:9: executing "-format" at
> <.Caller.Pkg.Object.P...>: can't evaluate field Object in type
> *ssa.Package
>
> any idea what I'm doing wrong?

For those who stumble upon similar error, here's what works for me:

$ callgraph -format '{{.Caller}} -> {{.Callee}}'
/usr/local/go/src/net/http/triv.go | sort | uniq
bufio.init -> bytes.init
bufio.init -> errors.init
bufio.init -> errors.New
bufio.init -> io.init
bufio.init -> unicode/utf8.init
bufio.NewReader -> bufio.NewReaderSize
...

The documentation printed out by callgraph (when run without any
arguments) says:

Caller and Callee are *ssa.Function values, which print as
"(*sync/atomic.Mutex).Lock"

That seems to no longer be true with the latest version of callgraph.

nazri

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] adding context.Context to new code

2017-05-17 Thread Nazri Ramliy
I'm about to embark on doing the same, and my first pit stop is at
using the callgraph to generate the caller-callee data but stumbled
upon this error while trying out the example given by the "callgraph"
command when run without arguments:

$ callgraph -format '{{.Caller.Pkg.Object.Path}} ->
{{.Callee.Pkg.Object.Path}}' /usr/local/go/src/net/http/triv.go | sort
| uniq
callgraph: template: -format:1:9: executing "-format" at
<.Caller.Pkg.Object.P...>: can't evaluate field Object in type
*ssa.Package

any idea what I'm doing wrong?

nazri

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.