It seems that marshaling and unmarshaling a zero time produces an object that is different from the original:
func TestMarshalUnmarshalJSON(t *testing.T) {
var expected, parsed Time
body, err := expected.MarshalJSON()
if err != nil {
t.Errorf("json.Marshal error = %v", err)
}
err = parsed.UnmarshalJSON(body)
if err != nil {
t.Errorf("json.Unmarshal error = %v", err)
}
if !reflect.DeepEqual(expected, parsed) {
t.Errorf("json error, expected = %#v, parsed = %#v", expected, parsed)
}
}
--- FAIL: TestMarshalUnmarshalJSON (0.00 seconds)
time_test.go:807: json error, expected = time.Time{sec:0, nsec:0x0, loc:(*time.Location)(nil)}, parsed = time.Time{sec:0, nsec:0x0, loc:(*time.Location)(0x6cd2a0)}