mailgun / godebug

DEPRECATED! https://github.com/derekparker/delve
Apache License 2.0
2.5k stars 107 forks source link

godebug build not using generated package files #45

Open xinhuang327 opened 9 years ago

xinhuang327 commented 9 years ago

Greetings, thank you for creating such an awesome tool for go developers. I have tried to use godebug to debug my project with many packages, I use following command to build:

godebug.exe build -instrument=github.com/..../cms/data

And then run the built binary but no breakpoint is activated.

Then I use -godebugwork to get generated go files, copy all the generated package files to origin directory, and use normal go build/run, I can then successfully enter the breakpoint and print vars etc...

I wonder why godebug build didn't use its generated files to build the executable, whether it's a bug or what did I do wong?

Thank you!

xinhuang327 commented 9 years ago

I looked into the source code and found this may be Windows platform specific. setGopath to tmpDir in cmd.go seems have no effect on go build, go tool still build with original GOPATH.

So I tweaked the code a little bit and resolve the issue: rename those package directory names before second build, and restore after build. (Changes in fork: https://github.com/xinhuang327/godebug/commit/26d0353fd5d07f7ba9baa78d775d769f0f4089b4)

This is just my nasty try, this issue still need further investigation and improvement.