@@ -71,10 +71,10 @@ import (
71
71
// false, 0, a nil pointer, a nil interface value, and any empty array,
72
72
// slice, map, or string.
73
73
//
74
- // The "heednull " option specifies that if the field is a slice or map
74
+ // The "nonil " option specifies that if the field is a slice or map
75
75
// of nil value, then the value encoded will be [] or {} respectively (instead
76
- // of "null"). If both "heednull " and "omitempty" are present, then "heednull " is
77
- // ignored. If the field is not a slice or map, "heednull " does nothing.
76
+ // of "null"). If both "nonil " and "omitempty" are present, then "nonil " is
77
+ // ignored. If the field is not a slice or map, "nonil " does nothing.
78
78
//
79
79
// As a special case, if the field tag is "-", the field is always omitted.
80
80
// Note that a field with name "-" can still be generated using the tag "-,".
@@ -662,7 +662,7 @@ FieldLoop:
662
662
}
663
663
opts .quoted = f .quoted
664
664
665
- if f .heedNull {
665
+ if f .noNil {
666
666
if f .typ .Kind () == reflect .Slice && fv .IsNil () {
667
667
e .WriteString ("[]" )
668
668
} else if f .typ .Kind () == reflect .Map && fv .IsNil () {
@@ -1055,7 +1055,7 @@ type field struct {
1055
1055
index []int
1056
1056
typ reflect.Type
1057
1057
omitEmpty bool
1058
- heedNull bool
1058
+ noNil bool
1059
1059
quoted bool
1060
1060
1061
1061
encoder encoderFunc
@@ -1173,7 +1173,7 @@ func typeFields(t reflect.Type) []field {
1173
1173
index : index ,
1174
1174
typ : ft ,
1175
1175
omitEmpty : opts .Contains ("omitempty" ),
1176
- heedNull : ! opts .Contains ("omitempty" ) && opts .Contains ("heednull " ),
1176
+ noNil : ! opts .Contains ("omitempty" ) && opts .Contains ("nonil " ),
1177
1177
quoted : quoted ,
1178
1178
}
1179
1179
field .nameBytes = []byte (field .name )
0 commit comments