-
Notifications
You must be signed in to change notification settings - Fork 18k
time: cannot roundtrip Parse the Time.String output #20876
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I argue that we should have |
The initial report is misleading. The full docs for time.Time.String say:
Are you aware of anyone round-tripping the output of String in production code? I am not. It's a mistake anyway since the String output gives the time zone twice, the second one will override the first one, and it's the less specific of the two. If there are widespread production uses of String output being fed into time.Parse, let me know. Otherwise, if someone wants to add to the end of the doc comment that
that's fine. |
CL https://golang.org/cl/47552 mentions this issue. |
SGTM. It was an assumption made by several tests. Fixing them will be easy. |
…stamp Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Fix parsing timestamp in test Go 1.9 changed the default string format, see golang/go#20876 As discussed there, default format is intended to be readable for humans and can change without warning, so we should probably set the format explicitly when writing status configmap. ```release-note NONE ```
Regression from Go1.8.
On tip, the documentation of
Time.String
says:This is misleading since it suggests that the following should work:
However, this does not work on Go1.9 since:
We should done one of the following:
Time.String
to not suggest that the format string is"2006-01-02 15:04:05.999999999 -0700 MST"
. We can suggest thatString
is intended only for human consumption and is not meant to be machine readable.Parse
, such that the monotonic timestamps can be ignored.\cc @bradfitz @rsc
The text was updated successfully, but these errors were encountered: