Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
time: cannot roundtrip Parse the Time.String output #20876
Regression from Go1.8.
On tip, the documentation of
This is misleading since it suggests that the following should work:
time.Parse("2006-01-02 15:04:05.999999999 -0700 MST", time.Now().String())
However, this does not work on Go1.9 since:
We should done one of the following:
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
…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 ```