proto: document reset memory aliasing guarantees

Change-Id: I2dc79c362278b6bc9ccf531067701cba5c392a50
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/219141
Reviewed-by: Damien Neil <dneil@google.com>
This commit is contained in:
Joe Tsai 2020-02-11 16:29:34 -08:00 committed by Joe Tsai
parent 25fc6fb4f2
commit e76af4be5e

View File

@ -7,8 +7,9 @@ package proto
import "google.golang.org/protobuf/reflect/protoreflect"
// Reset clears every field in the message.
// The resulting message shares no observable memory with its previous state
// other than the memory for the message itself.
func Reset(m Message) {
// TODO(blocks): Document memory aliasing guarantees.
if mr, ok := m.(interface{ Reset() }); ok && hasProtoMethods {
mr.Reset()
return