Updated and validated on January 17, 2022. You can find more tutorials on how to debug Go programs here. You may also refer to the Debugging section of our Help documentation.
In today’s post, we will continue exploring the debugger functionality in GoLand. If you want to know how to configure the debugger, please see our previous post which contains all the information on how to configure the IDE to work in various scenarios.
Before we launch our debugging session, let’s put in a few breakpoints for places where we are interested in knowing about how the code the runs, and then launch a debugging session (you can find the code in this repository).
Controlling the execution flow
We have complete control over the debugger from here. We can step into (F7), smart step into (Shift + F7/⇧ F7), step over (F8), step out (Shift + F8/⇧ F8), or run the code up to the cursor (Alt + F9/⌥ F9).
Evaluating expressions
We can also evaluate simple expressions and functions.
Watching custom values
We can also create a new watch to let us monitor custom expressions. This is useful when we want to watch a more complex expression or see only a certain value from a slice/map/struct.