Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
time: include const for time.Time.String()'s layout #6587
The layout used by the time.Time.String() method is hardcoded into the method. If it were a constant it would be easier to roundtrip time.Time's through a string (or byte) without having to copy and paste the layout out of Time.String's docstring. Relevant code: https://code.google.com/p/go/source/browse/src/pkg/time/format.go#397
The default format string is a clumsy one whose sole merit is that it represents all the pieces of the value. Few uses need that property alone. A better approach is to choose a format that meets your needs (say, RFC3999Nano) and use that explicitly. The only reason to publish this as a constant is to parse a default value again. If you're parsing, it's better to be clear about what you're printing too.
Status changed to WorkingAsIntended.