small refactor

This commit is contained in:
Lunny Xiao 2017-12-21 09:38:32 +08:00
parent 7cd4078f0b
commit cfbdcb6ce7
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
1 changed files with 5 additions and 5 deletions

View File

@ -1,11 +1,12 @@
package core
import (
"errors"
"fmt"
"time"
"bytes"
"encoding/gob"
"errors"
"fmt"
"strings"
"time"
)
const (
@ -55,11 +56,10 @@ func encodeIds(ids []PK) (string, error) {
return buf.String(), err
}
func decodeIds(s string) ([]PK, error) {
pks := make([]PK, 0)
dec := gob.NewDecoder(bytes.NewBufferString(s))
dec := gob.NewDecoder(strings.NewReader(s))
err := dec.Decode(&pks)
return pks, err