I'm currently trying to get the size of a complex struct in Go.
I've read solutions that use reflect
and unsafe
, but neither of these help with structs that contain arrays or maps (or any other field that's a pointer to an underlying data structure).
Example:
type testStruct struct {
A int
B string
C struct{}
items map[string]string
}
How would I find out the correct byte size of the above if items
contains a few values in it?
Aucun commentaire:
Enregistrer un commentaire