@@ -76,6 +76,10 @@ var marshalTests = []struct {
A int "a,omitempty"
B int "b,omitempty"
}{0, 0}},
+ {"{}\n", &struct {
+ A *struct{ X int } "a,omitempty"
+ B int "b,omitempty"
+ }{nil, 0}},
// Flow flag
{"a: [1, 2]\n", &struct {
@@ -256,7 +256,7 @@ func isZero(v reflect.Value) bool {
switch v.Kind() {
case reflect.String:
return len(v.String()) == 0
- case reflect.Interface:
+ case reflect.Interface, reflect.Ptr:
return v.IsNil()
case reflect.Slice:
return v.Len() == 0