fix: store and use by ref
This commit is contained in:
parent
e6c6ea473c
commit
15d0999fdf
|
@ -118,14 +118,14 @@ func unmarshalMapMsgpack(dec *msgpack.Decoder, m *linkedhashmap.Map, placeholder
|
||||||
if err := dec.Decode(&value); err != nil {
|
if err := dec.Decode(&value); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
m.Put(key, value)
|
m.Put(key, &value)
|
||||||
|
|
||||||
case *FileReference:
|
case *FileReference:
|
||||||
var file FileReference
|
var file FileReference
|
||||||
if err := dec.Decode(&file); err != nil {
|
if err := dec.Decode(&file); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
m.Put(key, file)
|
m.Put(key, &file)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("unsupported type for decoding")
|
return fmt.Errorf("unsupported type for decoding")
|
||||||
|
@ -161,11 +161,11 @@ func marshallMapMsgpack(enc *msgpack.Encoder, m *linkedhashmap.Map) error {
|
||||||
|
|
||||||
value := iter.Value()
|
value := iter.Value()
|
||||||
switch v := value.(type) {
|
switch v := value.(type) {
|
||||||
case FileReference:
|
case *FileReference:
|
||||||
if err := enc.Encode(&v); err != nil {
|
if err := enc.Encode(&v); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
case DirectoryReference:
|
case *DirectoryReference:
|
||||||
if err := enc.Encode(&v); err != nil {
|
if err := enc.Encode(&v); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue