mailgun/godebug

Flag to automatically break at program/test start

Closed this issue · 4 comments

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

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?

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

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

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.