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