mirror of
https://github.com/weaveworks/scope.git
synced 2026-08-18 03:46:45 +00:00
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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user