From the course: Debugging in Go
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Viewing program memory - Go Tutorial
From the course: Debugging in Go
Viewing program memory
- [Lecturer] In this video, we're going to take a look at how we can view and manipulate the value of variables in our program as it's executing. Just as always, let's go ahead and start a new debug session using DLV debug. Now, in this particular example, I have more of those runtime breakpoint statements scattered throughout the code, so I'm just going to go ahead and type continue. As you can see, we're stopped on line 54 and above that we have a few variables that have been initialized. If we list at line 49, we can see we have an int variable, which is a slice of int. We have a my map variable, which is a map of string to int and then we have a human, which is a new person and person is a struct. If we go back to where we currently are, you can see we're just about to start filling in the fields of the human struct. Let's go ahead and start printing out the value of some of these variables. First, let's take a look at all of the variables that are currently in scope. To do this…