How do I debug a Go program? I have been using the Gedit Go IDE, but it doesn\'t have debugging. Is there a way to step though my code and inspect memory? Or am I stuck with
Another initiative for go debugging session: hopwatch
Unlike most debuggers, hopwatch requires you to insert function calls at points of interest in your program. At these program locations, you can tell Hopwatch to display variable values and suspend the program (or goroutine).
Hopwatch uses Websockets to exchange commands between your program and the debugger running in a HTML5 page.
(so it is still similar to "print statement" but with a more elegant way to see the result without polluting stdout
and stderr
)
When your program calls the Break function, it sends debug information to the browser page and waits for user interaction.
Using the functionsDisplay
,Printf
orDump
(go-spew
), you can log information on the browser page.
On the hopwatch page, the developer can view debug information and choose to resume the execution of the program.