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>
// 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.