-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
FrozenDueToAgeSuggestedIssues that may be good for new contributors looking for work to do.Issues that may be good for new contributors looking for work to do.
Milestone
Description
by guillaume.gvt:
I have encountered a problem while trying to unmarshall time strings from json. In some cases, the error output is inaccurate. What steps will reproduce the problem? 1. create a json string containing a time string value. 2. try to unmarshall the json into a struct containing a time.Time var. 3. put a time string that does not match the default format (in my case the error is in the timezone part), and the error output fails to indicate the error properly. My test program is available here: http://play.golang.org/p/lIjVVFA1UF What is the expected output? parsing time ""2006-01-02T15:04:05Z07:00"" as ""2006-01-02T15:04:05Z07:00"": cannot parse "07:00"" as """ What do you see instead? parsing time ""2006-01-02T15:04:05Z07:00"" as ""2006-01-02T15:04:05Z07:00"": cannot parse "" as """ Which compiler are you using (5g, 6g, 8g, gccgo)? 6g Which operating system are you using? Linux 3.2.0-24-generic #39-Ubuntu SMP Mon May 21 16:52:17 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux Which version are you using? (run 'go version') go version go1 Please provide any additional information below. I have found a fix to get the result i desire, but i am not sure this is the best way to fix it. What i did is go to src/pkg/time/format.go and modify the skip function. I replaced both occurences of `return "", errBad` with `return value, errBad`
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeSuggestedIssues that may be good for new contributors looking for work to do.Issues that may be good for new contributors looking for work to do.