Unmarshalling a marshalled time object is failing, because of a few characters
Test
declare the following:
// values
now := time.Now()
timeToJSON, _ := json.Marshal(now)
var obj time.Time
json.Unmarshal(timeToJSON, &obj)
then do the following test logic:
if !assert.Equal(t,
now.String(),
obj.String()) {
t.FailNow()
}
Expected
the test to pass, and the two objects to be equal
Actual
It fails:
--- FAIL: TestFromJSON (0.00s)
D:\dev2017\GO\src\ezsoft\apiserver_sdk\model\delete\deleteModel_test.go:94:
Error Trace: deleteModel_test.go:94
Error: Not equal:
expected: "2018-09-04 10:36:18.3627338 -0400 EDT m=+0.014000801"
actual : "2018-09-04 10:36:18.3627338 -0400 EDT"
Diff:
--- Expected
+++ Actual
@@ -1 +1 @@
-2018-09-04 10:36:18.3627338 -0400 EDT m=+0.014000801
+2018-09-04 10:36:18.3627338 -0400 EDT
Test: TestFromJSON
FAIL
FAIL ezsoft/apiserver_sdk/model/delete 1.336s
Error: Tests failed.
NOTE
I notice that, upon inspecting the output, that, somehow, some m=+[blah]
is being appended to expected/actual.
I don't know why, however, and skimming RFC 3339 doesn't give me any hints why.