<p dir="auto">Please see:</p>
<p dir="auto"><a href="http://play.golang.org/p/VXUScwoGAH" rel="nofollow">http://play.golang.org/p/VXUScwoGAH</a></p>
<p dir="auto">I can see and understand why the final equality test returns false, but at the same time given that the default timezone is Z, would nevertheless expect the result to be true.</p>
<p dir="auto">It seems that marshaling and unmarshaling a zero time produces an object that is different from the original:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="func TestMarshalUnmarshalJSON(t *testing.T) {
        var expected, parsed Time

        body, err := expected.MarshalJSON()
        if err != nil {
                t.Errorf(&quot;json.Marshal error = %v&quot;, err)
        }

        err = parsed.UnmarshalJSON(body)
        if err != nil {
                t.Errorf(&quot;json.Unmarshal error = %v&quot;, err)
        }

        if !reflect.DeepEqual(expected, parsed) {
                t.Errorf(&quot;json error, expected = %#v, parsed = %#v&quot;, 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)}"><pre class="notranslate"><code class="notranslate">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)}
</code></pre></div>