Skip to content

Commit

Permalink
rename i to old
Browse files Browse the repository at this point in the history
  • Loading branch information
abhinav committed Nov 8, 2021
1 parent 0f33ed5 commit 9f6f2fc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions zapcore/json_encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,15 +211,16 @@ func (enc *jsonEncoder) AppendArray(arr ArrayMarshaler) error {
}

func (enc *jsonEncoder) AppendObject(obj ObjectMarshaler) error {
// close ONLY new openNamespaces that are created during AppendObject()
i := enc.openNamespaces
// Close ONLY new openNamespaces that are created during
// AppendObject().
old := enc.openNamespaces
enc.openNamespaces = 0
enc.addElementSeparator()
enc.buf.AppendByte('{')
err := obj.MarshalLogObject(enc)
enc.buf.AppendByte('}')
enc.closeOpenNamespaces()
enc.openNamespaces = i
enc.openNamespaces = old
return err
}

Expand Down

0 comments on commit 9f6f2fc

Please sign in to comment.