Skip to content

Instantly share code, notes, and snippets.

@locona
Created August 31, 2018 03:49
Show Gist options
  • Save locona/6506f3320566bce5346d9e3f651cbc88 to your computer and use it in GitHub Desktop.
Save locona/6506f3320566bce5346d9e3f651cbc88 to your computer and use it in GitHub Desktop.
package bloom
import (
"encoding/gob"
"bytes"
)
func GetBytes(key interface{}) ([]byte, error) {
var buf bytes.Buffer
enc := gob.NewEncoder(&buf)
err := enc.Encode(key)
if err != nil {
return nil, err
}
return buf.Bytes(), nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment