From 4a8ec3c01019bfc66a4fe6b37370c4d3aec48ca7 Mon Sep 17 00:00:00 2001 From: Andrew Z Allen Date: Wed, 1 Aug 2018 18:12:54 -0600 Subject: [PATCH] Fix up examples --- .../proto/examplepb/a_bit_of_everything.pb.go | 44 ++++++----- examples/proto/examplepb/echo_service.pb.go | 76 +++++++++++-------- 2 files changed, 66 insertions(+), 54 deletions(-) diff --git a/examples/proto/examplepb/a_bit_of_everything.pb.go b/examples/proto/examplepb/a_bit_of_everything.pb.go index 5e3779c36c7..da41accc08d 100644 --- a/examples/proto/examplepb/a_bit_of_everything.pb.go +++ b/examples/proto/examplepb/a_bit_of_everything.pb.go @@ -145,27 +145,6 @@ func (m *ABitOfEverything) XXX_DiscardUnknown() { var xxx_messageInfo_ABitOfEverything proto.InternalMessageInfo -type isABitOfEverything_OneofValue interface { - isABitOfEverything_OneofValue() -} - -type ABitOfEverything_OneofEmpty struct { - OneofEmpty *empty.Empty `protobuf:"bytes,20,opt,name=oneof_empty,json=oneofEmpty,proto3,oneof"` -} -type ABitOfEverything_OneofString struct { - OneofString string `protobuf:"bytes,21,opt,name=oneof_string,json=oneofString,proto3,oneof"` -} - -func (*ABitOfEverything_OneofEmpty) isABitOfEverything_OneofValue() {} -func (*ABitOfEverything_OneofString) isABitOfEverything_OneofValue() {} - -func (m *ABitOfEverything) GetOneofValue() isABitOfEverything_OneofValue { - if m != nil { - return m.OneofValue - } - return nil -} - func (m *ABitOfEverything) GetSingleNested() *ABitOfEverything_Nested { if m != nil { return m.SingleNested @@ -306,6 +285,29 @@ func (m *ABitOfEverything) GetRepeatedStringValue() []string { return nil } +type isABitOfEverything_OneofValue interface { + isABitOfEverything_OneofValue() +} + +type ABitOfEverything_OneofEmpty struct { + OneofEmpty *empty.Empty `protobuf:"bytes,20,opt,name=oneof_empty,json=oneofEmpty,proto3,oneof"` +} + +type ABitOfEverything_OneofString struct { + OneofString string `protobuf:"bytes,21,opt,name=oneof_string,json=oneofString,proto3,oneof"` +} + +func (*ABitOfEverything_OneofEmpty) isABitOfEverything_OneofValue() {} + +func (*ABitOfEverything_OneofString) isABitOfEverything_OneofValue() {} + +func (m *ABitOfEverything) GetOneofValue() isABitOfEverything_OneofValue { + if m != nil { + return m.OneofValue + } + return nil +} + func (m *ABitOfEverything) GetOneofEmpty() *empty.Empty { if x, ok := m.GetOneofValue().(*ABitOfEverything_OneofEmpty); ok { return x.OneofEmpty diff --git a/examples/proto/examplepb/echo_service.pb.go b/examples/proto/examplepb/echo_service.pb.go index c99f75b69cc..da8af13fbf9 100644 --- a/examples/proto/examplepb/echo_service.pb.go +++ b/examples/proto/examplepb/echo_service.pb.go @@ -73,12 +73,14 @@ type isEmbedded_Mark interface { type Embedded_Progress struct { Progress int64 `protobuf:"varint,1,opt,name=progress,proto3,oneof"` } + type Embedded_Note struct { Note string `protobuf:"bytes,2,opt,name=note,proto3,oneof"` } func (*Embedded_Progress) isEmbedded_Mark() {} -func (*Embedded_Note) isEmbedded_Mark() {} + +func (*Embedded_Note) isEmbedded_Mark() {} func (m *Embedded) GetMark() isEmbedded_Mark { if m != nil { @@ -209,30 +211,35 @@ func (m *SimpleMessage) XXX_DiscardUnknown() { var xxx_messageInfo_SimpleMessage proto.InternalMessageInfo +func (m *SimpleMessage) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *SimpleMessage) GetNum() int64 { + if m != nil { + return m.Num + } + return 0 +} + type isSimpleMessage_Code interface { isSimpleMessage_Code() } -type isSimpleMessage_Ext interface { - isSimpleMessage_Ext() -} type SimpleMessage_LineNum struct { LineNum int64 `protobuf:"varint,3,opt,name=line_num,json=lineNum,proto3,oneof"` } + type SimpleMessage_Lang struct { Lang string `protobuf:"bytes,4,opt,name=lang,proto3,oneof"` } -type SimpleMessage_En struct { - En int64 `protobuf:"varint,6,opt,name=en,proto3,oneof"` -} -type SimpleMessage_No struct { - No *Embedded `protobuf:"bytes,7,opt,name=no,proto3,oneof"` -} func (*SimpleMessage_LineNum) isSimpleMessage_Code() {} -func (*SimpleMessage_Lang) isSimpleMessage_Code() {} -func (*SimpleMessage_En) isSimpleMessage_Ext() {} -func (*SimpleMessage_No) isSimpleMessage_Ext() {} + +func (*SimpleMessage_Lang) isSimpleMessage_Code() {} func (m *SimpleMessage) GetCode() isSimpleMessage_Code { if m != nil { @@ -240,26 +247,6 @@ func (m *SimpleMessage) GetCode() isSimpleMessage_Code { } return nil } -func (m *SimpleMessage) GetExt() isSimpleMessage_Ext { - if m != nil { - return m.Ext - } - return nil -} - -func (m *SimpleMessage) GetId() string { - if m != nil { - return m.Id - } - return "" -} - -func (m *SimpleMessage) GetNum() int64 { - if m != nil { - return m.Num - } - return 0 -} func (m *SimpleMessage) GetLineNum() int64 { if x, ok := m.GetCode().(*SimpleMessage_LineNum); ok { @@ -282,6 +269,29 @@ func (m *SimpleMessage) GetStatus() *Embedded { return nil } +type isSimpleMessage_Ext interface { + isSimpleMessage_Ext() +} + +type SimpleMessage_En struct { + En int64 `protobuf:"varint,6,opt,name=en,proto3,oneof"` +} + +type SimpleMessage_No struct { + No *Embedded `protobuf:"bytes,7,opt,name=no,proto3,oneof"` +} + +func (*SimpleMessage_En) isSimpleMessage_Ext() {} + +func (*SimpleMessage_No) isSimpleMessage_Ext() {} + +func (m *SimpleMessage) GetExt() isSimpleMessage_Ext { + if m != nil { + return m.Ext + } + return nil +} + func (m *SimpleMessage) GetEn() int64 { if x, ok := m.GetExt().(*SimpleMessage_En); ok { return x.En