capnproto / go-capnp

Cap'n Proto library and code generator for Go
https://capnproto.org
Other
1.22k stars 110 forks source link

Text format includes null fields #158

Open kentonv opened 4 years ago

kentonv commented 4 years ago

The text format marshaller includes all fields in the output, even those with pointer type where the pointer is null. This differs from the C++ version, which only marshals pointer-typed fields if they are non-null. Some apps do actually depend on nullness, so IMO it's useful to represent this precisely in the text format.

I haven't tested, but I think this might also imply that a recursive struct type will lead to infinite recursion?

zombiezen commented 4 years ago

Sounds like a good change. I'm happy to review a PR for this.