Skip to content

Commit

Permalink
fix(codec): ThriftMarshal
Browse files Browse the repository at this point in the history
Change-Id: Ia6d24fc15450f04d77765eadb9d37817404ae3d0
  • Loading branch information
andeya committed Jun 25, 2019
1 parent a6224fa commit 5951dbb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions codec/thrift_codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 5951dbb

Please sign in to comment.