Why MarshalToSizedBuffer is in reverse order when use the latest gogofaster
bestans opened this issue · 0 comments
bestans commented
Now, I cannot Marshal two message into one fixed size buffer unless re-allocated buffer.
func (m *MessageHead) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MessageHead.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)] // Notice! MarshalToSizedBuffer will fill data into b from the end
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}