From 179a0fe5d85ece79f2738a5bdacaa3d137a3e999 Mon Sep 17 00:00:00 2001 From: xuhui-liu_css Date: Fri, 26 Jun 2026 15:10:38 -0700 Subject: [PATCH 1/3] add Size --- encoding/protox/proto.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/encoding/protox/proto.go b/encoding/protox/proto.go index 8896a61..cd1cdc7 100644 --- a/encoding/protox/proto.go +++ b/encoding/protox/proto.go @@ -49,6 +49,13 @@ func MarshalTextString(m proto.Message) string { return prototext.Format(m) } +// Size returns the size in bytes of the wire-format encoding of m. +// It is a wrapper of proto.Size() +func Size(m proto.Message) int { + return proto.Size(m) +} + + // Clone returns a deep copy of m. If the top-level message is invalid, // it returns an invalid message as well. func Clone[M proto.Message](m M) M { From 9052764809b79e9c4e816a322592601a93a80a9c Mon Sep 17 00:00:00 2001 From: xuhui-liu_css Date: Fri, 26 Jun 2026 15:23:40 -0700 Subject: [PATCH 2/3] mend add size() function --- encoding/protox/proto.go | 1 - 1 file changed, 1 deletion(-) diff --git a/encoding/protox/proto.go b/encoding/protox/proto.go index cd1cdc7..820937b 100644 --- a/encoding/protox/proto.go +++ b/encoding/protox/proto.go @@ -55,7 +55,6 @@ func Size(m proto.Message) int { return proto.Size(m) } - // Clone returns a deep copy of m. If the top-level message is invalid, // it returns an invalid message as well. func Clone[M proto.Message](m M) M { From 0b3ddd47360a1efcf61f2d408a69989adfe29366 Mon Sep 17 00:00:00 2001 From: xuhui-liu_css Date: Fri, 26 Jun 2026 15:43:35 -0700 Subject: [PATCH 3/3] update comments --- encoding/protox/proto.go | 1 - 1 file changed, 1 deletion(-) diff --git a/encoding/protox/proto.go b/encoding/protox/proto.go index 820937b..fce4e91 100644 --- a/encoding/protox/proto.go +++ b/encoding/protox/proto.go @@ -50,7 +50,6 @@ func MarshalTextString(m proto.Message) string { } // Size returns the size in bytes of the wire-format encoding of m. -// It is a wrapper of proto.Size() func Size(m proto.Message) int { return proto.Size(m) }