mailgun / godebug

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

Flag to automatically break at program/test start #52

Closed willfaught closed 2 years ago

willfaught commented 9 years ago

I suppose this can always be done manually by putting _ = "breakpoint" as the first line in your main or Test* funcs, but it would be really handy to be able to go to any main package and just do godebug run or godebug test and be debugging immediately.

Perhaps an optional -debug.break flag or something could enable this: godebug run -debug.break and godebug test -debug.break

jeremyschlatter commented 9 years ago

This is doable. It's not something I have wanted myself, though -- can you give an example where this would be helpful, so I can better understand the use case?

One thing I have considered doing is automatically inserting a breakpoint at program/test start when there are no other breakpoints. Would that provide what you want? Or are there times when you have inserted explicit _ = "breakpoint" lines in your source and you also want to beak at program/test start?

willfaught commented 9 years ago

Automatically inserting a breakpoint at program/test start when there are no other breakpoints would be perfect.

blamarche commented 8 years ago

Not to necro this... but for use in environments with strict code quality control, having devs forget to remove _ = "breakpoint" lines when committing becomes an annoying overhead problem. So related to this particular feature request, would also be nice to have the ability to pass in breakpoints via the command line by specifying the file+line number. Something like: godebug run -break=file1.go:34,file2.go:183 ...

willfaught commented 8 years ago

I've had that problem too. I like that idea. The ability to name funcs/methods to break at the start of would be useful too.