From 8863c10ef4620346310b8091f8fd6e4f9600a9ad Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Thu, 21 Dec 2023 00:06:56 +0300 Subject: [PATCH] client/noop: fix metadata overwrite Signed-off-by: Vasiliy Tolstov --- client/noop.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/noop.go b/client/noop.go index 52a4da68..dd4085cb 100644 --- a/client/noop.go +++ b/client/noop.go @@ -486,11 +486,12 @@ func (n *noopClient) publish(ctx context.Context, ps []Message, opts ...PublishO msgs := make([]*broker.Message, 0, len(ps)) for _, p := range ps { - md, ok := metadata.FromOutgoingContext(ctx) + omd, ok := metadata.FromOutgoingContext(ctx) if !ok { - md = metadata.New(0) + omd = metadata.New(0) } + md := metadata.Copy(omd) iter := p.Metadata().Iterator() var k, v string for iter.Next(&k, &v) {