From 5951dbb1d7ba4287a4c74c561f40645050fd08ec Mon Sep 17 00:00:00 2001 From: henrylee2cn Date: Tue, 25 Jun 2019 13:40:42 +0800 Subject: [PATCH] fix(codec): ThriftMarshal Change-Id: Ia6d24fc15450f04d77765eadb9d37817404ae3d0 --- codec/thrift_codec.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/codec/thrift_codec.go b/codec/thrift_codec.go index 7793d79a..cdecf6c4 100644 --- a/codec/thrift_codec.go +++ b/codec/thrift_codec.go @@ -67,9 +67,11 @@ func ThriftMarshal(v interface{}) ([]byte, error) { p := thrift.NewTBinaryProtocol(trans, false, false) switch s := v.(type) { case thrift.TStruct: - return trans.Buffer.Bytes(), s.Write(p) + err := s.Write(p) + return trans.Buffer.Bytes(), err case nil, *struct{}, struct{}: - return trans.Buffer.Bytes(), ThriftEmptyStruct.Write(p) + err := ThriftEmptyStruct.Write(p) + return trans.Buffer.Bytes(), err } return nil, fmt.Errorf("thrift codec: %T does not implement thrift.TStruct", v) }