You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unfortunately, adding this method to the ArrayMarshaler interface is a breaking change - it'll immediately stop all third-party implementations of ArrayMarshaler from compiling. I've added it to the 2.0 wishlist in #388, though.
Today, I know of two workarounds for this. Internally, we usually don't log null values - in your second example, you'd just skip logging nil users. If that doesn't work for you, you can use the AppendReflected method to add a nil. For JSON, serializing nil with reflection is pretty fast - it shouldn't impact performance much.
I'm currently using custom marshaller and noticed that
zapcore.ArrayEncoder
does not support to append nil value.Please see below example.
This example crashes at
enc.AddString("name", u.name)
.If
zapcore.ArrayEncoder
hasAppendNil
method, I can write as belowExpected log is
The text was updated successfully, but these errors were encountered: