mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-07-26 13:47:40 +00:00
Revert "msgpack incompatible with Go 1, try to use json instead."
This reverts commit 807bcc77f9.
This commit is contained in:
Vendored
+12
-6
@@ -1,8 +1,9 @@
|
|||||||
package debian
|
package debian
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"bytes"
|
||||||
debc "github.com/smira/godebiancontrol"
|
debc "github.com/smira/godebiancontrol"
|
||||||
|
"github.com/ugorji/go/codec"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -61,13 +62,18 @@ func (p *Package) Key() []byte {
|
|||||||
return []byte(p.Name + " " + p.Version + " " + p.Architecture)
|
return []byte(p.Name + " " + p.Version + " " + p.Architecture)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encode does serializing of Package
|
// Encode does msgpack encoding of Package
|
||||||
func (p *Package) Encode() []byte {
|
func (p *Package) Encode() []byte {
|
||||||
result, _ := json.Marshal(p)
|
var buf bytes.Buffer
|
||||||
return result
|
|
||||||
|
encoder := codec.NewEncoder(&buf, &codec.MsgpackHandle{})
|
||||||
|
encoder.Encode(p)
|
||||||
|
|
||||||
|
return buf.Bytes()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decode unserializes representation into Package
|
// Decode decodes msgpack representation into Package
|
||||||
func (p *Package) Decode(input []byte) error {
|
func (p *Package) Decode(input []byte) error {
|
||||||
return json.Unmarshal(input, p)
|
decoder := codec.NewDecoderBytes(input, &codec.MsgpackHandle{})
|
||||||
|
return decoder.Decode(p)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user