Skip to content

Commit 1f9119f

Browse files
Go Protobuf: add an example to the builders section
PiperOrigin-RevId: 846220379
1 parent 4327d73 commit 1f9119f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

content/reference/go/go-generated-opaque.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,19 @@ not meant to be passed around between functions. Instead, call `Build()`
512512
immediately and pass the resulting proto message instead, using setters to
513513
modify fields.
514514

515+
Here is an example for using builders to create a `Band` message, which is the
516+
only repeated field inside the enclosing `Concert` message:
517+
518+
```go
519+
concert := Concert_builder{
520+
SupportActs: []*Band{
521+
Band_builder{
522+
Name: proto.String("Varint and the Marshals"),
523+
}.Build()
524+
},
525+
}.Build()
526+
```
527+
515528
## Enumerations {#enum}
516529

517530
Given an enumeration like:

0 commit comments

Comments
 (0)