It is simply impossible to distinguish.
If you detached data from XML or JSON, use pointers.
type Animal struct {
Name *string
LegCount *int
}
You will get the values nilfor the missing fields.
You can use the same convention in your case.
source
share