clean code use time.IsZero() replace t = time.Time{}, make code more readable

Signed-off-by: chuanshuo <lilijreey@126.com>
This commit is contained in:
chuanshuo 2024-05-15 22:05:50 +08:00
parent 853c5de11e
commit 47b807e0d7
1 changed files with 1 additions and 1 deletions

View File

@ -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)