Skip to content

Commit 619eb59

Browse files
author
beorn7
committed
Simplify an append to copy
Signed-off-by: beorn7 <[email protected]>
1 parent fae8896 commit 619eb59

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

prometheus/registry.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -909,8 +909,8 @@ func checkDescConsistency(
909909
}
910910

911911
// Is the desc consistent with the content of the metric?
912-
lpsFromDesc := make([]*dto.LabelPair, 0, len(dtoMetric.Label))
913-
lpsFromDesc = append(lpsFromDesc, desc.constLabelPairs...)
912+
lpsFromDesc := make([]*dto.LabelPair, len(desc.constLabelPairs), len(dtoMetric.Label))
913+
copy(lpsFromDesc, desc.constLabelPairs)
914914
for _, l := range desc.variableLabels {
915915
lpsFromDesc = append(lpsFromDesc, &dto.LabelPair{
916916
Name: proto.String(l),

0 commit comments

Comments
 (0)