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

2024-03-01 Thread 'Yash Bansal' via golang-nuts
@nazri Were you able to achieve this? Adding context to every function. Is 
there any repository/library available for the same. 

I have been one of the unaware ones who started writing a new service 
without adding context explicitly. 

On Friday, May 19, 2017 at 9:34:22 AM UTC+5:30 Nazri Ramliy wrote:

> On Wed, May 17, 2017 at 3:55 PM, Nazri Ramliy  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
>

-- 
*::DISCLAIMER::


The contents of this e-mail and any attachments are confidential and 
intended for the named recipient(s) only.E-mail transmission is not 
guaranteed to be secure or error-free as information could be intercepted, 
corrupted,lost, destroyed, arrive late or incomplete, or may contain 
viruses in transmission. The e mail and its contents(with or without 
referred errors) shall therefore not attach any liability on the originator 
or redBus.com. Views or opinions, if any, presented in this email are 
solely those of the author and may not necessarily reflect the views or 
opinions of redBus.com. Any form of reproduction, dissemination, copying, 
disclosure, modification,distribution and / or publication of this message 
without the prior written consent of authorized representative of redbus. 
com is strictly prohibited. If you have received this 
email in error please delete it and notify the sender immediately.Before 
opening any email and/or attachments, please check them for viruses and 
other defects.*

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/ef2e49c2-59f1-49ce-97bd-676b7c898eddn%40googlegroups.com.


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  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.