From 0a4f130b39969f636e7ba3a80110399d451b68e7 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Fri, 30 Aug 2024 09:38:38 +0100 Subject: [PATCH] [Comment] Correct the comment on Decbuf.UvarintBytes The value is valid when returned, but can become invalid later. Return to previous wording. Signed-off-by: Bryan Boreham --- tsdb/encoding/encoding.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tsdb/encoding/encoding.go b/tsdb/encoding/encoding.go index 88fdd30c8..a7ce4e81e 100644 --- a/tsdb/encoding/encoding.go +++ b/tsdb/encoding/encoding.go @@ -201,8 +201,9 @@ func (d *Decbuf) UvarintStr() string { return string(d.UvarintBytes()) } -// UvarintBytes returns invalid values if the byte slice goes away. -// Compared to UvarintStr, it avoid allocations. +// UvarintBytes returns a pointer to internal data; +// the return value becomes invalid if the byte slice goes away. +// Compared to UvarintStr, this avoids allocations. func (d *Decbuf) UvarintBytes() []byte { l := d.Uvarint64() if d.E != nil {