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:
parent
853c5de11e
commit
47b807e0d7
|
@ -234,7 +234,7 @@ func NewMetricWithExemplars(m Metric, exemplars ...Exemplar) (Metric, error) {
|
||||||
)
|
)
|
||||||
for i, e := range exemplars {
|
for i, e := range exemplars {
|
||||||
ts := e.Timestamp
|
ts := e.Timestamp
|
||||||
if ts == (time.Time{}) {
|
if ts.IsZero() {
|
||||||
ts = now
|
ts = now
|
||||||
}
|
}
|
||||||
exs[i], err = newExemplar(e.Value, ts, e.Labels)
|
exs[i], err = newExemplar(e.Value, ts, e.Labels)
|
||||||
|
|
Loading…
Reference in New Issue