From 47b807e0d7d608379b519f40474ceac1c664a18f Mon Sep 17 00:00:00 2001 From: chuanshuo Date: Wed, 15 May 2024 22:05:50 +0800 Subject: [PATCH] clean code use time.IsZero() replace t = time.Time{}, make code more readable Signed-off-by: chuanshuo --- prometheus/metric.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prometheus/metric.go b/prometheus/metric.go index f018e57..9d9b81a 100644 --- a/prometheus/metric.go +++ b/prometheus/metric.go @@ -234,7 +234,7 @@ func NewMetricWithExemplars(m Metric, exemplars ...Exemplar) (Metric, error) { ) for i, e := range exemplars { ts := e.Timestamp - if ts == (time.Time{}) { + if ts.IsZero() { ts = now } exs[i], err = newExemplar(e.Value, ts, e.Labels)