Stop causing errors by parsing empty strings as time.Time

We encode the zero time as an empty string, so we should do the
reverse when decoding.

Otherwise time.Parse() returns an error, which is created on the heap,
causing extra garbage-collection load.
This commit is contained in:
Bryan Boreham
2017-09-30 14:33:20 +00:00
parent 46c5fca7ce
commit 9322b54b68
+3
View File
@@ -238,6 +238,9 @@ func renderTime(t time.Time) string {
}
func parseTime(s string) time.Time {
if s == "" {
return time.Time{}
}
t, _ := time.Parse(time.RFC3339Nano, s)
return t
}