mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2025-01-07 12:56:47 +00:00
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>
This commit is contained in:
parent
494e81bd5a
commit
7a48e2b662
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user