aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorSasha Melentyev <sasha@melentyev.io>2022-09-03 18:56:43 +0000
committerGopher Robot <gobot@golang.org>2022-09-19 16:58:39 +0000
commit0857633f8b4ca4b28aad160d1dd1dbb1fe5a4d7d (patch)
tree42e16d156643b03e1a2f689416164e21ee372863 /src/runtime
parentc91b1009d52d91eb3a949945789ff235246c0075 (diff)
downloadgo-0857633f8b4ca4b28aad160d1dd1dbb1fe5a4d7d.tar.xz
runtime/pprof: set labelMap length
Change-Id: If09094e72161f2c5da9102706781524e32f87782 GitHub-Last-Rev: 89949bc6ee8622be31c4e4db45ea6da11fd9053f 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>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/pprof/label.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/pprof/label.go b/src/runtime/pprof/label.go
index 0c58a7ac47..d39e0ad58e 100644
--- a/src/runtime/pprof/label.go
+++ b/src/runtime/pprof/label.go
@@ -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.