diff --git a/refs/marshal.go b/refs/marshal.go index dc8517f..ef85324 100644 --- a/refs/marshal.go +++ b/refs/marshal.go @@ -118,11 +118,11 @@ func (o *ObjectID) StableSize() int { func ObjectIDNestedListMarshal(fNum int64, buf []byte, ids []ObjectID) (off int) { prefix, _ := proto.NestedStructurePrefix(fNum) for i := range ids { - off += binary.PutUvarint(buf, prefix) + off += binary.PutUvarint(buf[off:], prefix) n := ids[i].StableSize() off += binary.PutUvarint(buf[off:], uint64(n)) - off += proto.BytesMarshal(objectIDValField, buf, ids[i].val) + off += proto.BytesMarshal(objectIDValField, buf[off:], ids[i].val) } return diff --git a/rpc/message/test/message.go b/rpc/message/test/message.go index e3ce9cd..7c4450f 100644 --- a/rpc/message/test/message.go +++ b/rpc/message/test/message.go @@ -16,7 +16,7 @@ type jsonMessage interface { } type binaryMessage interface { - StableMarshal([]byte) ([]byte, error) + StableMarshal([]byte) []byte Unmarshal([]byte) error } @@ -54,8 +54,7 @@ func TestRPCMessage(t *testing.T, msgGens ...func(empty bool) message.Message) { if bm, ok := msg.(binaryMessage); ok { t.Run(fmt.Sprintf("Binary_%T", msg), func(t *testing.T) { - data, err := bm.StableMarshal(nil) - require.NoError(t, err) + data := bm.StableMarshal(nil) bm2 := msgGen(true).(binaryMessage) require.NoError(t, bm2.Unmarshal(data))