Skip to content

Commit c9125d3

Browse files
committed
Add comment on special handling for single marshaler
1 parent 26b53cc commit c9125d3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

zapcore/error.go

+2
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ func encodeError(key string, err error, enc ObjectEncoder) (retErr error) {
8989

9090
switch {
9191
case len(marshalers) == 1:
92+
// Special-case handling of single marshaler to avoid an alloc
93+
// converting mergedMarshalers to an ObjectMarshaler interface.
9294
if err := enc.AddObject(key+"Fields", marshalers[0]); err != nil {
9395
return err
9496
}

0 commit comments

Comments
 (0)