From 9d397869d89256dc80a9a803c85ea7a8e9aba758 Mon Sep 17 00:00:00 2001 From: Edward McFarlane Date: Tue, 17 Mar 2020 23:54:49 +0000 Subject: [PATCH] types/dynamicpb: fix message Zero return type to read-only Changes the message Zero return type to be read-only by omitting internal known map. Change-Id: I1c1191a125df74251be3d8bb70f4b06c1ff57070 Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/223857 Reviewed-by: Joe Tsai --- types/dynamicpb/dynamic.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/dynamicpb/dynamic.go b/types/dynamicpb/dynamic.go index 86371cfb..2a41fc87 100644 --- a/types/dynamicpb/dynamic.go +++ b/types/dynamicpb/dynamic.go @@ -323,7 +323,7 @@ func NewMessageType(desc pref.MessageDescriptor) pref.MessageType { } func (mt messageType) New() pref.Message { return NewMessage(mt.desc) } -func (mt messageType) Zero() pref.Message { return NewMessage(mt.desc) } +func (mt messageType) Zero() pref.Message { return &Message{typ: messageType{mt.desc}} } func (mt messageType) Descriptor() pref.MessageDescriptor { return mt.desc } type emptyList struct {