go-capnp icon indicating copy to clipboard operation
go-capnp copied to clipboard

Text format includes null fields

Open kentonv opened this issue 3 years ago • 1 comments

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?

kentonv avatar Sep 10 '20 23:09 kentonv

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

zombiezen avatar Sep 13 '20 15:09 zombiezen