runtime/pprof: set labelMap length

Change-Id: If09094e72161f2c5da9102706781524e32f87782
GitHub-Last-Rev: 89949bc6ee
GitHub-Pull-Request: golang/go#54855
Reviewed-on: https://go-review.googlesource.com/c/go/+/428234
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Sasha Melentyev 2022-09-03 18:56:43 +00:00 committed by Gopher Robot
parent c91b1009d5
commit 0857633f8b

View file

@ -57,8 +57,8 @@ func (l *labelMap) String() string {
// WithLabels returns a new context.Context with the given labels added.
// A label overwrites a prior label with the same key.
func WithLabels(ctx context.Context, labels LabelSet) context.Context {
childLabels := make(labelMap)
parentLabels := labelValue(ctx)
childLabels := make(labelMap, len(parentLabels))
// TODO(matloob): replace the map implementation with something
// more efficient so creating a child context WithLabels doesn't need
// to clone the map.