Function is similar to C union, write configuration file similar

message BBB{ string b=1; } message CCC{ int b=1; } message AAA { oneof payload { BBB b; CCC c; }}

To create a structure, manually create a structure in oneof. This would be similar:

msg := &xxx.AAA{Payload: &xxx.AAA_BBB{B: &xxx.B{"123"}}}

It is used to parse out whether it is BBB or CCC

switch msg.Payload.(type) {
    case *(xxx.AAA_BBB):
    case *(xxx.AAA_CCC):
}