godebug icon indicating copy to clipboard operation
godebug copied to clipboard

surprising behavior with -instrument and godep

Open jeremyschlatter opened this issue 10 years ago • 2 comments

I am debugging a program that has a dependency on package foo, and I want to step into function calls in foo. So I run:

$ godebug run -instrument=foo myProg.go

godebug runs without complaint. Yet, to my surprise, I still can't step into foo. Why? Because I had forgotten that I was using godep. I would have been fine if I had instead run:

$ godebug run -instrument=my/package/name/Godeps/_workspace/src/foo

It would be nice if godebug caught this for me. At a minimum, it could have noticed that I didn't import package foo anywhere, and warned me that it was useless to pass that package in the instrument flag.

Alternatively, maybe we should get rid of the -instrument flag entirely. Having it sacrifices some usability for performance, but I don't understand the tradeoff very well. How much performance would we lose by instrumenting everything? Can we make that better? How often does the flag cause surprising behavior?

jeremyschlatter avatar Jun 06 '15 00:06 jeremyschlatter

same issue. having to declare package path:

$ godebug run -instrument=github.com/jesusjjf/myproject/package1,github.com/jesusjjf/myproject/package2 myproject.go

+1 on godebug being able to detect automatically

Awesome tool!!

jsgv avatar Jun 25 '15 18:06 jsgv

+1 on the awesomeness of the tool +1 on some way to handle this

benfleis avatar Sep 08 '15 08:09 benfleis