Why does it output false
? I was expecting true
...
package main
import (
"fmt"
"time"
"gopkg.in/mgo.v2/bson"
)
type S struct {
T time.Time
}
func main() {
t := S{time.Now()}
bytes, _ := bson.Marshal(t)
var dt S
bson.Unmarshal(bytes, &dt)
fmt.Println(dt.T.Equal(t.T))
}
go run
the above will output false
, why Marshal/Unmarshal
doesn't preserve the original value?