When I debug a go program in GoLand, I can't see the value of global variable. Can anyone tell me why and how to fix it?
Here is an example:
I set a breakpoint in the last line of main function. But as shown in the picture, we can only get the value of 'a', but not 'a' and 'xx'.
package main
import "fmt"
var xx int = 1
func main() {
var a int = 1
fmt.Println(a)
xx = 3
fmt.Println("end")
}
We can use Evaluate function to get the value of global variables, but can only get one value each time
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With