1
0
mirror of https://github.com/astaxie/beego.git synced 2025-06-12 08:40:39 +00:00

golint tidb

This commit is contained in:
astaxie
2015-09-17 23:00:05 +08:00
parent dfbb1b5ee5
commit 3df0fa462d
2 changed files with 27 additions and 0 deletions

View File

@ -43,6 +43,7 @@ func init() {
gob.Register(map[int]int64{})
}
// EncodeGob encode the obj to gob
func EncodeGob(obj map[interface{}]interface{}) ([]byte, error) {
for _, v := range obj {
gob.Register(v)
@ -56,6 +57,7 @@ func EncodeGob(obj map[interface{}]interface{}) ([]byte, error) {
return buf.Bytes(), nil
}
// DecodeGob decode data to map
func DecodeGob(encoded []byte) (map[interface{}]interface{}, error) {
buf := bytes.NewBuffer(encoded)
dec := gob.NewDecoder(buf)