rpc.debugLog unexported

99 views
Skip to first unread message

dick.r...@gmail.com

unread,
Dec 7, 2019, 12:13:26 PM12/7/19
to golan...@googlegroups.com
How can I turn on debugging in net/rpc/server.go?

There is a promising variable called `debugLog` in there. How should I toggle it?

Ian Lance Taylor

unread,
Dec 7, 2019, 2:12:18 PM12/7/19
to dick.r...@gmail.com, golang-nuts
On Sat, Dec 7, 2019 at 9:12 AM <dick.r...@gmail.com> wrote:
>
> How can I turn on debugging in net/rpc/server.go?
>
> There is a promising variable called `debugLog` in there. How should I toggle it?

I don't know how much it will help, but the way to toggle it is to
literally edit net/rpc/debug.go to set debugLog to true. There's no
mechanism for setting it dynamically.

Ian

dick.r...@gmail.com

unread,
Dec 8, 2019, 1:07:55 PM12/8/19
to Ian Lance Taylor, golang-nuts
Thanks for your reply. Do you regularly edit standard libs as described (and
then presumably edit them back)?

I copied /usr/lib/go-1.13/net/rpc to my project directory, then changed all
imports of "net/rpc" to "./net/rpc", and then set debugLog (in my shadow copy,
not /usr/lib/go-1.13). It got the job done but still felt wrong.

Ian Lance Taylor

unread,
Dec 8, 2019, 1:42:15 PM12/8/19
to dick.r...@gmail.com, golang-nuts
On Sun, Dec 8, 2019 at 10:07 AM <dick.r...@gmail.com> wrote:
>
> Thanks for your reply. Do you regularly edit standard libs as described (and
> then presumably edit them back)?

While debugging the standard library, yes, I do. But I also agree
that for this case it might be useful to have a more usable mechanism.

> I copied /usr/lib/go-1.13/net/rpc to my project directory, then changed all
> imports of "net/rpc" to "./net/rpc", and then set debugLog (in my shadow copy,
> not /usr/lib/go-1.13). It got the job done but still felt wrong.

If that helped solve the problem then I would encourage you to file an
issue asking for a mechanism to set debugLog in a simpler way, perhaps
via the `GODEBUG` environment variable or perhaps via a function in
the net/rpc package.

Ian

Atakan Çolak

unread,
Dec 9, 2019, 11:57:29 AM12/9/19
to golang-nuts
Hi,

I had tried a similar approach for customizing golokia

Why do we need to move the imported packages code to the project directory? 
Doesn't go compile using the local copy of the imported package in GOPATH? 

What am I missing here?

8 Aralık 2019 Pazar 21:07:55 UTC+3 tarihinde dickmao yazdı:
Thanks for your reply.  Do you regularly edit standard libs as described (and
then presumably edit them back)?

I copied /usr/lib/go-1.13/net/rpc to my project directory, then changed all
imports of "net/rpc" to "./net/rpc", and then set debugLog (in my shadow copy,
not /usr/lib/go-1.13).  It got the job done but still felt wrong.

>>>>> Ian Lance Taylor <ia...@golang.org> writes:

Reply all
Reply to author
Forward
0 new messages