Encrypted messaging app
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
276 B

package Util
import (
"bytes"
"encoding/gob"
)
func ToBytes(key interface{}) ([]byte, error) {
var (
buf bytes.Buffer
enc *gob.Encoder
err error
)
enc = gob.NewEncoder(&buf)
err = enc.Encode(key)
if err != nil {
return nil, err
}
return buf.Bytes(), nil
}