aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stapelberg <stapelberg@google.com>2022-09-20 10:02:01 +0200
committerMichael Stapelberg <stapelberg@google.com>2022-09-20 08:06:00 +0000
commit7a48e2b66218ba306ed801e42126b374aefce255 (patch)
tree54849af8e67660b846bd01f7ece3cf287a915c75
parent494e81bd5a5d6213d3f395ec1b6aeb7f41d44166 (diff)
downloadgolang-protobuf-7a48e2b66218ba306ed801e42126b374aefce255.tar.gz
protoreflect: fix list example code
Change-Id: I2c8afba104ae97be5e575226a47f6a7f20198abe Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/431798 Reviewed-by: Nicolas Hillegeer <aktau@google.com>
-rw-r--r--reflect/protoreflect/value_union.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/reflect/protoreflect/value_union.go b/reflect/protoreflect/value_union.go
index ca8e28c5..08e5ef73 100644
--- a/reflect/protoreflect/value_union.go
+++ b/reflect/protoreflect/value_union.go
@@ -54,11 +54,11 @@ import (
// // Append a 0 to a "repeated int32" field.
// // Since the Value returned by Mutable is guaranteed to alias
// // the source message, modifying the Value modifies the message.
-// message.Mutable(fieldDesc).(List).Append(protoreflect.ValueOfInt32(0))
+// message.Mutable(fieldDesc).List().Append(protoreflect.ValueOfInt32(0))
//
// // Assign [0] to a "repeated int32" field by creating a new Value,
// // modifying it, and assigning it.
-// list := message.NewField(fieldDesc).(List)
+// list := message.NewField(fieldDesc).List()
// list.Append(protoreflect.ValueOfInt32(0))
// message.Set(fieldDesc, list)
// // ERROR: Since it is not defined whether Set aliases the source,