From df19bac7aa81f46916571cd4c4518092f1d3c349 Mon Sep 17 00:00:00 2001 From: Ross Light Date: Sun, 19 Jun 2016 09:22:49 -0700 Subject: [PATCH] encoding/text: use TextBytes in Encode --- encoding/text/marshal.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/encoding/text/marshal.go b/encoding/text/marshal.go index 6989727c..579d1a6a 100644 --- a/encoding/text/marshal.go +++ b/encoding/text/marshal.go @@ -308,12 +308,7 @@ func (enc *Encoder) marshalFieldValue(s capnp.Struct, f schema.Field) error { enc.marshalText(b) return nil } - b := p.Data() - if len(b) > 0 { - // Trim NUL byte - b = b[:len(b)-1] - } - enc.marshalText(b) + enc.marshalText(p.TextBytes()) case schema.Type_Which_list: elem, err := typ.List().ElementType() if err != nil {