diff --git a/persist.go b/persist.go index 2b0bca1..f8e70bb 100644 --- a/persist.go +++ b/persist.go @@ -28,6 +28,10 @@ type Var struct { opt Option } +type encVar struct { + X interface{} +} + type Option struct { Permanent bool } @@ -224,12 +228,13 @@ type encoded struct { func encode(p *Var,chs ...chan struct{}) encoded { ret := encoded{name:[]byte(p.name)} + ep := encVar{ p.X } if len(chs) > 0 { ret.donech = chs[0] } var buf bytes.Buffer enc := gob.NewEncoder(&buf) - err := enc.Encode(*p) + err := enc.Encode(ep) if err != nil { fmt.Println("encode(): ",err) }