In Golang, is there an easy way to print for debugging the dereferenced pointers given a slice of pointers to structs?
If you don't want to use unsafe and an external package.. you can range
over it yourself:
for _, p := range people {
fmt.Printf("%+v\n", p)
}
Output:
&{name:Simon age:25}
&{name:Bob age:31}
Working sample: http://play.golang.org/p/aVw0rhQNuk
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