aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Symonds <dsymonds@golang.org>2013-03-23 12:17:58 +1100
committerDavid Symonds <dsymonds@golang.org>2013-03-23 12:17:58 +1100
commit22e7eb4717085235b29a5ae20e11b9bcd89f412f (patch)
treefaf022ce9edad81bcdabcd2af1f83d89db348b35
parent69cffb22f077cce568aa4403ff2dbf67cd71d52b (diff)
downloadprotobuf-22e7eb4717085235b29a5ae20e11b9bcd89f412f.tar.gz
goprotobuf: Preserve unknown fields in groups, and generate repeated field getters.
Also make receiver names idiomatic. R=r CC=golang-dev https://codereview.appspot.com/7922045
-rw-r--r--proto/testdata/test.pb.go1058
-rw-r--r--protoc-gen-go/descriptor/descriptor.pb.go601
-rw-r--r--protoc-gen-go/generator/generator.go73
-rw-r--r--protoc-gen-go/plugin/plugin.pb.go69
-rw-r--r--protoc-gen-go/testdata/my_test/test.pb.go131
-rw-r--r--protoc-gen-go/testdata/my_test/test.pb.go.golden131
6 files changed, 1260 insertions, 803 deletions
diff --git a/proto/testdata/test.pb.go b/proto/testdata/test.pb.go
index cfd1dfd..cfd184b 100644
--- a/proto/testdata/test.pb.go
+++ b/proto/testdata/test.pb.go
@@ -231,13 +231,13 @@ type GoEnum struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *GoEnum) Reset() { *this = GoEnum{} }
-func (this *GoEnum) String() string { return proto.CompactTextString(this) }
-func (*GoEnum) ProtoMessage() {}
+func (m *GoEnum) Reset() { *m = GoEnum{} }
+func (m *GoEnum) String() string { return proto.CompactTextString(m) }
+func (*GoEnum) ProtoMessage() {}
-func (this *GoEnum) GetFoo() FOO {
- if this != nil && this.Foo != nil {
- return *this.Foo
+func (m *GoEnum) GetFoo() FOO {
+ if m != nil && m.Foo != nil {
+ return *m.Foo
}
return 0
}
@@ -248,20 +248,20 @@ type GoTestField struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *GoTestField) Reset() { *this = GoTestField{} }
-func (this *GoTestField) String() string { return proto.CompactTextString(this) }
-func (*GoTestField) ProtoMessage() {}
+func (m *GoTestField) Reset() { *m = GoTestField{} }
+func (m *GoTestField) String() string { return proto.CompactTextString(m) }
+func (*GoTestField) ProtoMessage() {}
-func (this *GoTestField) GetLabel() string {
- if this != nil && this.Label != nil {
- return *this.Label
+func (m *GoTestField) GetLabel() string {
+ if m != nil && m.Label != nil {
+ return *m.Label
}
return ""
}
-func (this *GoTestField) GetType() string {
- if this != nil && this.Type != nil {
- return *this.Type
+func (m *GoTestField) GetType() string {
+ if m != nil && m.Type != nil {
+ return *m.Type
}
return ""
}
@@ -342,9 +342,9 @@ type GoTest struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *GoTest) Reset() { *this = GoTest{} }
-func (this *GoTest) String() string { return proto.CompactTextString(this) }
-func (*GoTest) ProtoMessage() {}
+func (m *GoTest) Reset() { *m = GoTest{} }
+func (m *GoTest) String() string { return proto.CompactTextString(m) }
+func (*GoTest) ProtoMessage() {}
const Default_GoTest_F_BoolDefaulted bool = true
const Default_GoTest_F_Int32Defaulted int32 = 32
@@ -362,363 +362,548 @@ var Default_GoTest_F_BytesDefaulted []byte = []byte("Bignose")
const Default_GoTest_F_Sint32Defaulted int32 = -32
const Default_GoTest_F_Sint64Defaulted int64 = -64
-func (this *GoTest) GetKind() GoTest_KIND {
- if this != nil && this.Kind != nil {
- return *this.Kind
+func (m *GoTest) GetKind() GoTest_KIND {
+ if m != nil && m.Kind != nil {
+ return *m.Kind
}
return 0
}
-func (this *GoTest) GetTable() string {
- if this != nil && this.Table != nil {
- return *this.Table
+func (m *GoTest) GetTable() string {
+ if m != nil && m.Table != nil {
+ return *m.Table
}
return ""
}
-func (this *GoTest) GetParam() int32 {
- if this != nil && this.Param != nil {
- return *this.Param
+func (m *GoTest) GetParam() int32 {
+ if m != nil && m.Param != nil {
+ return *m.Param
}
return 0
}
-func (this *GoTest) GetRequiredField() *GoTestField {
- if this != nil {
- return this.RequiredField
+func (m *GoTest) GetRequiredField() *GoTestField {
+ if m != nil {
+ return m.RequiredField
}
return nil
}
-func (this *GoTest) GetOptionalField() *GoTestField {
- if this != nil {
- return this.OptionalField
+func (m *GoTest) GetRepeatedField() []*GoTestField {
+ if m != nil {
+ return m.RepeatedField
}
return nil
}
-func (this *GoTest) GetF_BoolRequired() bool {
- if this != nil && this.F_BoolRequired != nil {
- return *this.F_BoolRequired
+func (m *GoTest) GetOptionalField() *GoTestField {
+ if m != nil {
+ return m.OptionalField
+ }
+ return nil
+}
+
+func (m *GoTest) GetF_BoolRequired() bool {
+ if m != nil && m.F_BoolRequired != nil {
+ return *m.F_BoolRequired
}
return false
}
-func (this *GoTest) GetF_Int32Required() int32 {
- if this != nil && this.F_Int32Required != nil {
- return *this.F_Int32Required
+func (m *GoTest) GetF_Int32Required() int32 {
+ if m != nil && m.F_Int32Required != nil {
+ return *m.F_Int32Required
}
return 0
}
-func (this *GoTest) GetF_Int64Required() int64 {
- if this != nil && this.F_Int64Required != nil {
- return *this.F_Int64Required
+func (m *GoTest) GetF_Int64Required() int64 {
+ if m != nil && m.F_Int64Required != nil {
+ return *m.F_Int64Required
}
return 0
}
-func (this *GoTest) GetF_Fixed32Required() uint32 {
- if this != nil && this.F_Fixed32Required != nil {
- return *this.F_Fixed32Required
+func (m *GoTest) GetF_Fixed32Required() uint32 {
+ if m != nil && m.F_Fixed32Required != nil {
+ return *m.F_Fixed32Required
}
return 0
}
-func (this *GoTest) GetF_Fixed64Required() uint64 {
- if this != nil && this.F_Fixed64Required != nil {
- return *this.F_Fixed64Required
+func (m *GoTest) GetF_Fixed64Required() uint64 {
+ if m != nil && m.F_Fixed64Required != nil {
+ return *m.F_Fixed64Required
}
return 0
}
-func (this *GoTest) GetF_Uint32Required() uint32 {
- if this != nil && this.F_Uint32Required != nil {
- return *this.F_Uint32Required
+func (m *GoTest) GetF_Uint32Required() uint32 {
+ if m != nil && m.F_Uint32Required != nil {
+ return *m.F_Uint32Required
}
return 0
}
-func (this *GoTest) GetF_Uint64Required() uint64 {
- if this != nil && this.F_Uint64Required != nil {
- return *this.F_Uint64Required
+func (m *GoTest) GetF_Uint64Required() uint64 {
+ if m != nil && m.F_Uint64Required != nil {
+ return *m.F_Uint64Required
}
return 0
}
-func (this *GoTest) GetF_FloatRequired() float32 {
- if this != nil && this.F_FloatRequired != nil {
- return *this.F_FloatRequired
+func (m *GoTest) GetF_FloatRequired() float32 {
+ if m != nil && m.F_FloatRequired != nil {
+ return *m.F_FloatRequired
}
return 0
}
-func (this *GoTest) GetF_DoubleRequired() float64 {
- if this != nil && this.F_DoubleRequired != nil {
- return *this.F_DoubleRequired
+func (m *GoTest) GetF_DoubleRequired() float64 {
+ if m != nil && m.F_DoubleRequired != nil {
+ return *m.F_DoubleRequired
}
return 0
}
-func (this *GoTest) GetF_StringRequired() string {
- if this != nil && this.F_StringRequired != nil {
- return *this.F_StringRequired
+func (m *GoTest) GetF_StringRequired() string {
+ if m != nil && m.F_StringRequired != nil {
+ return *m.F_StringRequired
}
return ""
}
-func (this *GoTest) GetF_BytesRequired() []byte {
- if this != nil {
- return this.F_BytesRequired
+func (m *GoTest) GetF_BytesRequired() []byte {
+ if m != nil {
+ return m.F_BytesRequired
}
return nil
}
-func (this *GoTest) GetF_Sint32Required() int32 {
- if this != nil && this.F_Sint32Required != nil {
- return *this.F_Sint32Required
+func (m *GoTest) GetF_Sint32Required() int32 {
+ if m != nil && m.F_Sint32Required != nil {
+ return *m.F_Sint32Required
}
return 0
}
-func (this *GoTest) GetF_Sint64Required() int64 {
- if this != nil && this.F_Sint64Required != nil {
- return *this.F_Sint64Required
+func (m *GoTest) GetF_Sint64Required() int64 {
+ if m != nil && m.F_Sint64Required != nil {
+ return *m.F_Sint64Required
}
return 0
}
-func (this *GoTest) GetF_BoolOptional() bool {
- if this != nil && this.F_BoolOptional != nil {
- return *this.F_BoolOptional
+func (m *GoTest) GetF_BoolRepeated() []bool {
+ if m != nil {
+ return m.F_BoolRepeated
+ }
+ return nil
+}
+
+func (m *GoTest) GetF_Int32Repeated() []int32 {
+ if m != nil {
+ return m.F_Int32Repeated
+ }
+ return nil
+}
+
+func (m *GoTest) GetF_Int64Repeated() []int64 {
+ if m != nil {
+ return m.F_Int64Repeated
+ }
+ return nil
+}
+
+func (m *GoTest) GetF_Fixed32Repeated() []uint32 {
+ if m != nil {
+ return m.F_Fixed32Repeated
+ }
+ return nil
+}
+
+func (m *GoTest) GetF_Fixed64Repeated() []uint64 {
+ if m != nil {
+ return m.F_Fixed64Repeated
+ }
+ return nil
+}
+
+func (m *GoTest) GetF_Uint32Repeated() []uint32 {
+ if m != nil {
+ return m.F_Uint32Repeated
+ }
+ return nil
+}
+
+func (m *GoTest) GetF_Uint64Repeated() []uint64 {
+ if m != nil {
+ return m.F_Uint64Repeated
+ }
+ return nil
+}
+
+func (m *GoTest) GetF_FloatRepeated() []float32 {
+ if m != nil {
+ return m.F_FloatRepeated
+ }
+ return nil
+}
+
+func (m *GoTest) GetF_DoubleRepeated() []float64 {
+ if m != nil {
+ return m.F_DoubleRepeated
+ }
+ return nil
+}
+
+func (m *GoTest) GetF_StringRepeated() []string {
+ if m != nil {
+ return m.F_StringRepeated
+ }
+ return nil
+}
+
+func (m *GoTest) GetF_BytesRepeated() [][]byte {
+ if m != nil {
+ return m.F_BytesRepeated
+ }
+ return nil
+}
+
+func (m *GoTest) GetF_Sint32Repeated() []int32 {
+ if m != nil {
+ return m.F_Sint32Repeated
+ }
+ return nil
+}
+
+func (m *GoTest) GetF_Sint64Repeated() []int64 {
+ if m != nil {
+ return m.F_Sint64Repeated
+ }
+ return nil
+}
+
+func (m *GoTest) GetF_BoolOptional() bool {
+ if m != nil && m.F_BoolOptional != nil {
+ return *m.F_BoolOptional
}
return false
}
-func (this *GoTest) GetF_Int32Optional() int32 {
- if this != nil && this.F_Int32Optional != nil {
- return *this.F_Int32Optional
+func (m *GoTest) GetF_Int32Optional() int32 {
+ if m != nil && m.F_Int32Optional != nil {
+ return *m.F_Int32Optional
}
return 0
}
-func (this *GoTest) GetF_Int64Optional() int64 {
- if this != nil && this.F_Int64Optional != nil {
- return *this.F_Int64Optional
+func (m *GoTest) GetF_Int64Optional() int64 {
+ if m != nil && m.F_Int64Optional != nil {
+ return *m.F_Int64Optional
}
return 0
}
-func (this *GoTest) GetF_Fixed32Optional() uint32 {
- if this != nil && this.F_Fixed32Optional != nil {
- return *this.F_Fixed32Optional
+func (m *GoTest) GetF_Fixed32Optional() uint32 {
+ if m != nil && m.F_Fixed32Optional != nil {
+ return *m.F_Fixed32Optional
}
return 0
}
-func (this *GoTest) GetF_Fixed64Optional() uint64 {
- if this != nil && this.F_Fixed64Optional != nil {
- return *this.F_Fixed64Optional
+func (m *GoTest) GetF_Fixed64Optional() uint64 {
+ if m != nil && m.F_Fixed64Optional != nil {
+ return *m.F_Fixed64Optional
}
return 0
}
-func (this *GoTest) GetF_Uint32Optional() uint32 {
- if this != nil && this.F_Uint32Optional != nil {
- return *this.F_Uint32Optional
+func (m *GoTest) GetF_Uint32Optional() uint32 {
+ if m != nil && m.F_Uint32Optional != nil {
+ return *m.F_Uint32Optional
}
return 0
}
-func (this *GoTest) GetF_Uint64Optional() uint64 {
- if this != nil && this.F_Uint64Optional != nil {
- return *this.F_Uint64Optional
+func (m *GoTest) GetF_Uint64Optional() uint64 {
+ if m != nil && m.F_Uint64Optional != nil {
+ return *m.F_Uint64Optional
}
return 0
}
-func (this *GoTest) GetF_FloatOptional() float32 {
- if this != nil && this.F_FloatOptional != nil {
- return *this.F_FloatOptional
+func (m *GoTest) GetF_FloatOptional() float32 {
+ if m != nil && m.F_FloatOptional != nil {
+ return *m.F_FloatOptional
}
return 0
}
-func (this *GoTest) GetF_DoubleOptional() float64 {
- if this != nil && this.F_DoubleOptional != nil {
- return *this.F_DoubleOptional
+func (m *GoTest) GetF_DoubleOptional() float64 {
+ if m != nil && m.F_DoubleOptional != nil {
+ return *m.F_DoubleOptional
}
return 0
}
-func (this *GoTest) GetF_StringOptional() string {
- if this != nil && this.F_StringOptional != nil {
- return *this.F_StringOptional
+func (m *GoTest) GetF_StringOptional() string {
+ if m != nil && m.F_StringOptional != nil {
+ return *m.F_StringOptional
}
return ""
}
-func (this *GoTest) GetF_BytesOptional() []byte {
- if this != nil {
- return this.F_BytesOptional
+func (m *GoTest) GetF_BytesOptional() []byte {
+ if m != nil {
+ return m.F_BytesOptional
}
return nil
}
-func (this *GoTest) GetF_Sint32Optional() int32 {
- if this != nil && this.F_Sint32Optional != nil {
- return *this.F_Sint32Optional
+func (m *GoTest) GetF_Sint32Optional() int32 {
+ if m != nil && m.F_Sint32Optional != nil {
+ return *m.F_Sint32Optional
}
return 0
}
-func (this *GoTest) GetF_Sint64Optional() int64 {
- if this != nil && this.F_Sint64Optional != nil {
- return *this.F_Sint64Optional
+func (m *GoTest) GetF_Sint64Optional() int64 {
+ if m != nil && m.F_Sint64Optional != nil {
+ return *m.F_Sint64Optional
}
return 0
}
-func (this *GoTest) GetF_BoolDefaulted() bool {
- if this != nil && this.F_BoolDefaulted != nil {
- return *this.F_BoolDefaulted
+func (m *GoTest) GetF_BoolDefaulted() bool {
+ if m != nil && m.F_BoolDefaulted != nil {
+ return *m.F_BoolDefaulted
}
return Default_GoTest_F_BoolDefaulted
}
-func (this *GoTest) GetF_Int32Defaulted() int32 {
- if this != nil && this.F_Int32Defaulted != nil {
- return *this.F_Int32Defaulted
+func (m *GoTest) GetF_Int32Defaulted() int32 {
+ if m != nil && m.F_Int32Defaulted != nil {
+ return *m.F_Int32Defaulted
}
return Default_GoTest_F_Int32Defaulted
}
-func (this *GoTest) GetF_Int64Defaulted() int64 {
- if this != nil && this.F_Int64Defaulted != nil {
- return *this.F_Int64Defaulted
+func (m *GoTest) GetF_Int64Defaulted() int64 {
+ if m != nil && m.F_Int64Defaulted != nil {
+ return *m.F_Int64Defaulted
}
return Default_GoTest_F_Int64Defaulted
}
-func (this *GoTest) GetF_Fixed32Defaulted() uint32 {
- if this != nil && this.F_Fixed32Defaulted != nil {
- return *this.F_Fixed32Defaulted
+func (m *GoTest) GetF_Fixed32Defaulted() uint32 {
+ if m != nil && m.F_Fixed32Defaulted != nil {
+ return *m.F_Fixed32Defaulted
}
return Default_GoTest_F_Fixed32Defaulted
}
-func (this *GoTest) GetF_Fixed64Defaulted() uint64 {
- if this != nil && this.F_Fixed64Defaulted != nil {
- return *this.F_Fixed64Defaulted
+func (m *GoTest) GetF_Fixed64Defaulted() uint64 {
+ if m != nil && m.F_Fixed64Defaulted != nil {
+ return *m.F_Fixed64Defaulted
}
return Default_GoTest_F_Fixed64Defaulted
}
-func (this *GoTest) GetF_Uint32Defaulted() uint32 {
- if this != nil && this.F_Uint32Defaulted != nil {
- return *this.F_Uint32Defaulted
+func (m *GoTest) GetF_Uint32Defaulted() uint32 {
+ if m != nil && m.F_Uint32Defaulted != nil {
+ return *m.F_Uint32Defaulted
}
return Default_GoTest_F_Uint32Defaulted
}
-func (this *GoTest) GetF_Uint64Defaulted() uint64 {
- if this != nil && this.F_Uint64Defaulted != nil {
- return *this.F_Uint64Defaulted
+func (m *GoTest) GetF_Uint64Defaulted() uint64 {
+ if m != nil && m.F_Uint64Defaulted != nil {
+ return *m.F_Uint64Defaulted
}
return Default_GoTest_F_Uint64Defaulted
}
-func (this *GoTest) GetF_FloatDefaulted() float32 {
- if this != nil && this.F_FloatDefaulted != nil {
- return *this.F_FloatDefaulted
+func (m *GoTest) GetF_FloatDefaulted() float32 {
+ if m != nil && m.F_FloatDefaulted != nil {
+ return *m.F_FloatDefaulted
}
return Default_GoTest_F_FloatDefaulted
}
-func (this *GoTest) GetF_DoubleDefaulted() float64 {
- if this != nil && this.F_DoubleDefaulted != nil {
- return *this.F_DoubleDefaulted
+func (m *GoTest) GetF_DoubleDefaulted() float64 {
+ if m != nil && m.F_DoubleDefaulted != nil {
+ return *m.F_DoubleDefaulted
}
return Default_GoTest_F_DoubleDefaulted
}
-func (this *GoTest) GetF_StringDefaulted() string {
- if this != nil && this.F_StringDefaulted != nil {
- return *this.F_StringDefaulted
+func (m *GoTest) GetF_StringDefaulted() string {
+ if m != nil && m.F_StringDefaulted != nil {
+ return *m.F_StringDefaulted
}
return Default_GoTest_F_StringDefaulted
}
-func (this *GoTest) GetF_BytesDefaulted() []byte {
- if this != nil && this.F_BytesDefaulted != nil {
- return this.F_BytesDefaulted
+func (m *GoTest) GetF_BytesDefaulted() []byte {
+ if m != nil && m.F_BytesDefaulted != nil {
+ return m.F_BytesDefaulted
}
return append([]byte(nil), Default_GoTest_F_BytesDefaulted...)
}
-func (this *GoTest) GetF_Sint32Defaulted() int32 {
- if this != nil && this.F_Sint32Defaulted != nil {
- return *this.F_Sint32Defaulted
+func (m *GoTest) GetF_Sint32Defaulted() int32 {
+ if m != nil && m.F_Sint32Defaulted != nil {
+ return *m.F_Sint32Defaulted
}
return Default_GoTest_F_Sint32Defaulted
}
-func (this *GoTest) GetF_Sint64Defaulted() int64 {
- if this != nil && this.F_Sint64Defaulted != nil {
- return *this.F_Sint64Defaulted
+func (m *GoTest) GetF_Sint64Defaulted() int64 {
+ if m != nil && m.F_Sint64Defaulted != nil {
+ return *m.F_Sint64Defaulted
}
return Default_GoTest_F_Sint64Defaulted
}
-func (this *GoTest) GetRequiredgroup() *GoTest_RequiredGroup {
- if this != nil {
- return this.Requiredgroup
+func (m *GoTest) GetF_BoolRepeatedPacked() []bool {
+ if m != nil {
+ return m.F_BoolRepeatedPacked
+ }
+ return nil
+}
+
+func (m *GoTest) GetF_Int32RepeatedPacked() []int32 {
+ if m != nil {
+ return m.F_Int32RepeatedPacked
+ }
+ return nil
+}
+
+func (m *GoTest) GetF_Int64RepeatedPacked() []int64 {
+ if m != nil {
+ return m.F_Int64RepeatedPacked
+ }
+ return nil
+}
+
+func (m *GoTest) GetF_Fixed32RepeatedPacked() []uint32 {
+ if m != nil {
+ return m.F_Fixed32RepeatedPacked
+ }
+ return nil
+}
+
+func (m *GoTest) GetF_Fixed64RepeatedPacked() []uint64 {
+ if m != nil {
+ return m.F_Fixed64RepeatedPacked
+ }
+ return nil
+}
+
+func (m *GoTest) GetF_Uint32RepeatedPacked() []uint32 {
+ if m != nil {
+ return m.F_Uint32RepeatedPacked
+ }
+ return nil
+}
+
+func (m *GoTest) GetF_Uint64RepeatedPacked() []uint64 {
+ if m != nil {
+ return m.F_Uint64RepeatedPacked
+ }
+ return nil
+}
+
+func (m *GoTest) GetF_FloatRepeatedPacked() []float32 {
+ if m != nil {
+ return m.F_FloatRepeatedPacked
+ }
+ return nil
+}
+
+func (m *GoTest) GetF_DoubleRepeatedPacked() []float64 {
+ if m != nil {
+ return m.F_DoubleRepeatedPacked
+ }
+ return nil
+}
+
+func (m *GoTest) GetF_Sint32RepeatedPacked() []int32 {
+ if m != nil {
+ return m.F_Sint32RepeatedPacked
+ }
+ return nil
+}
+
+func (m *GoTest) GetF_Sint64RepeatedPacked() []int64 {
+ if m != nil {
+ return m.F_Sint64RepeatedPacked
+ }
+ return nil
+}
+
+func (m *GoTest) GetRequiredgroup() *GoTest_RequiredGroup {
+ if m != nil {
+ return m.Requiredgroup
+ }
+ return nil
+}
+
+func (m *GoTest) GetRepeatedgroup() []*GoTest_RepeatedGroup {
+ if m != nil {
+ return m.Repeatedgroup
}
return nil
}
-func (this *GoTest) GetOptionalgroup() *GoTest_OptionalGroup {
- if this != nil {
- return this.Optionalgroup
+func (m *GoTest) GetOptionalgroup() *GoTest_OptionalGroup {
+ if m != nil {
+ return m.Optionalgroup
}
return nil
}
type GoTest_RequiredGroup struct {
- RequiredField *string `protobuf:"bytes,71,req" json:"RequiredField,omitempty"`
+ RequiredField *string `protobuf:"bytes,71,req" json:"RequiredField,omitempty"`
+ XXX_unrecognized []byte `json:"-"`
}
-func (this *GoTest_RequiredGroup) Reset() { *this = GoTest_RequiredGroup{} }
+func (m *GoTest_RequiredGroup) Reset() { *m = GoTest_RequiredGroup{} }
-func (this *GoTest_RequiredGroup) GetRequiredField() string {
- if this != nil && this.RequiredField != nil {
- return *this.RequiredField
+func (m *GoTest_RequiredGroup) GetRequiredField() string {
+ if m != nil && m.RequiredField != nil {
+ return *m.RequiredField
}
return ""
}
type GoTest_RepeatedGroup struct {
- RequiredField *string `protobuf:"bytes,81,req" json:"RequiredField,omitempty"`
+ RequiredField *string `protobuf:"bytes,81,req" json:"RequiredField,omitempty"`
+ XXX_unrecognized []byte `json:"-"`
}
-func (this *GoTest_RepeatedGroup) Reset() { *this = GoTest_RepeatedGroup{} }
+func (m *GoTest_RepeatedGroup) Reset() { *m = GoTest_RepeatedGroup{} }
-func (this *GoTest_RepeatedGroup) GetRequiredField() string {
- if this != nil && this.RequiredField != nil {
- return *this.RequiredField
+func (m *GoTest_RepeatedGroup) GetRequiredField() string {
+ if m != nil && m.RequiredField != nil {
+ return *m.RequiredField
}
return ""
}
type GoTest_OptionalGroup struct {
- RequiredField *string `protobuf:"bytes,91,req" json:"RequiredField,omitempty"`
+ RequiredField *string `protobuf:"bytes,91,req" json:"RequiredField,omitempty"`
+ XXX_unrecognized []byte `json:"-"`
}
-func (this *GoTest_OptionalGroup) Reset() { *this = GoTest_OptionalGroup{} }
+func (m *GoTest_OptionalGroup) Reset() { *m = GoTest_OptionalGroup{} }
-func (this *GoTest_OptionalGroup) GetRequiredField() string {
- if this != nil && this.RequiredField != nil {
- return *this.RequiredField
+func (m *GoTest_OptionalGroup) GetRequiredField() string {
+ if m != nil && m.RequiredField != nil {
+ return *m.RequiredField
}
return ""
}
@@ -732,62 +917,63 @@ type GoSkipTest struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *GoSkipTest) Reset() { *this = GoSkipTest{} }
-func (this *GoSkipTest) String() string { return proto.CompactTextString(this) }
-func (*GoSkipTest) ProtoMessage() {}
+func (m *GoSkipTest) Reset() { *m = GoSkipTest{} }
+func (m *GoSkipTest) String() string { return proto.CompactTextString(m) }
+func (*GoSkipTest) ProtoMessage() {}
-func (this *GoSkipTest) GetSkipInt32() int32 {
- if this != nil && this.SkipInt32 != nil {
- return *this.SkipInt32
+func (m *GoSkipTest) GetSkipInt32() int32 {
+ if m != nil && m.SkipInt32 != nil {
+ return *m.SkipInt32
}
return 0
}
-func (this *GoSkipTest) GetSkipFixed32() uint32 {
- if this != nil && this.SkipFixed32 != nil {
- return *this.SkipFixed32
+func (m *GoSkipTest) GetSkipFixed32() uint32 {
+ if m != nil && m.SkipFixed32 != nil {
+ return *m.SkipFixed32
}
return 0
}
-func (this *GoSkipTest) GetSkipFixed64() uint64 {
- if this != nil && this.SkipFixed64 != nil {
- return *this.SkipFixed64
+func (m *GoSkipTest) GetSkipFixed64() uint64 {
+ if m != nil && m.SkipFixed64 != nil {
+ return *m.SkipFixed64
}
return 0
}
-func (this *GoSkipTest) GetSkipString() string {
- if this != nil && this.SkipString != nil {
- return *this.SkipString
+func (m *GoSkipTest) GetSkipString() string {
+ if m != nil && m.SkipString != nil {
+ return *m.SkipString
}
return ""
}
-func (this *GoSkipTest) GetSkipgroup() *GoSkipTest_SkipGroup {
- if this != nil {
- return this.Skipgroup
+func (m *GoSkipTest) GetSkipgroup() *GoSkipTest_SkipGroup {
+ if m != nil {
+ return m.Skipgroup
}
return nil
}
type GoSkipTest_SkipGroup struct {
- GroupInt32 *int32 `protobuf:"varint,16,req,name=group_int32" json:"group_int32,omitempty"`
- GroupString *string `protobuf:"bytes,17,req,name=group_string" json:"group_string,omitempty"`
+ GroupInt32 *int32 `protobuf:"varint,16,req,name=group_int32" json:"group_int32,omitempty"`
+ GroupString *string `protobuf:"bytes,17,req,name=group_string" json:"group_string,omitempty"`
+ XXX_unrecognized []byte `json:"-"`
}
-func (this *GoSkipTest_SkipGroup) Reset() { *this = GoSkipTest_SkipGroup{} }
+func (m *GoSkipTest_SkipGroup) Reset() { *m = GoSkipTest_SkipGroup{} }
-func (this *GoSkipTest_SkipGroup) GetGroupInt32() int32 {
- if this != nil && this.GroupInt32 != nil {
- return *this.GroupInt32
+func (m *GoSkipTest_SkipGroup) GetGroupInt32() int32 {
+ if m != nil && m.GroupInt32 != nil {
+ return *m.GroupInt32
}
return 0
}
-func (this *GoSkipTest_SkipGroup) GetGroupString() string {
- if this != nil && this.GroupString != nil {
- return *this.GroupString
+func (m *GoSkipTest_SkipGroup) GetGroupString() string {
+ if m != nil && m.GroupString != nil {
+ return *m.GroupString
}
return ""
}
@@ -797,31 +983,45 @@ type NonPackedTest struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *NonPackedTest) Reset() { *this = NonPackedTest{} }
-func (this *NonPackedTest) String() string { return proto.CompactTextString(this) }
-func (*NonPackedTest) ProtoMessage() {}
+func (m *NonPackedTest) Reset() { *m = NonPackedTest{} }
+func (m *NonPackedTest) String() string { return proto.CompactTextString(m) }
+func (*NonPackedTest) ProtoMessage() {}
+
+func (m *NonPackedTest) GetA() []int32 {
+ if m != nil {
+ return m.A
+ }
+ return nil
+}
type PackedTest struct {
B []int32 `protobuf:"varint,1,rep,packed,name=b" json:"b,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
-func (this *PackedTest) Reset() { *this = PackedTest{} }
-func (this *PackedTest) String() string { return proto.CompactTextString(this) }
-func (*PackedTest) ProtoMessage() {}
+func (m *PackedTest) Reset() { *m = PackedTest{} }
+func (m *PackedTest) String() string { return proto.CompactTextString(m) }
+func (*PackedTest) ProtoMessage() {}
+
+func (m *PackedTest) GetB() []int32 {
+ if m != nil {
+ return m.B
+ }
+ return nil
+}
type MaxTag struct {
LastField *string `protobuf:"bytes,536870911,opt,name=last_field" json:"last_field,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
-func (this *MaxTag) Reset() { *this = MaxTag{} }
-func (this *MaxTag) String() string { return proto.CompactTextString(this) }
-func (*MaxTag) ProtoMessage() {}
+func (m *MaxTag) Reset() { *m = MaxTag{} }
+func (m *MaxTag) String() string { return proto.CompactTextString(m) }
+func (*MaxTag) ProtoMessage() {}
-func (this *MaxTag) GetLastField() string {
- if this != nil && this.LastField != nil {
- return *this.LastField
+func (m *MaxTag) GetLastField() string {
+ if m != nil && m.LastField != nil {
+ return *m.LastField
}
return ""
}
@@ -831,13 +1031,13 @@ type OldMessage struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *OldMessage) Reset() { *this = OldMessage{} }
-func (this *OldMessage) String() string { return proto.CompactTextString(this) }
-func (*OldMessage) ProtoMessage() {}
+func (m *OldMessage) Reset() { *m = OldMessage{} }
+func (m *OldMessage) String() string { return proto.CompactTextString(m) }
+func (*OldMessage) ProtoMessage() {}
-func (this *OldMessage) GetNested() *OldMessage_Nested {
- if this != nil {
- return this.Nested
+func (m *OldMessage) GetNested() *OldMessage_Nested {
+ if m != nil {
+ return m.Nested
}
return nil
}
@@ -847,13 +1047,13 @@ type OldMessage_Nested struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *OldMessage_Nested) Reset() { *this = OldMessage_Nested{} }
-func (this *OldMessage_Nested) String() string { return proto.CompactTextString(this) }
-func (*OldMessage_Nested) ProtoMessage() {}
+func (m *OldMessage_Nested) Reset() { *m = OldMessage_Nested{} }
+func (m *OldMessage_Nested) String() string { return proto.CompactTextString(m) }
+func (*OldMessage_Nested) ProtoMessage() {}
-func (this *OldMessage_Nested) GetName() string {
- if this != nil && this.Name != nil {
- return *this.Name
+func (m *OldMessage_Nested) GetName() string {
+ if m != nil && m.Name != nil {
+ return *m.Name
}
return ""
}
@@ -863,13 +1063,13 @@ type NewMessage struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *NewMessage) Reset() { *this = NewMessage{} }
-func (this *NewMessage) String() string { return proto.CompactTextString(this) }
-func (*NewMessage) ProtoMessage() {}
+func (m *NewMessage) Reset() { *m = NewMessage{} }
+func (m *NewMessage) String() string { return proto.CompactTextString(m) }
+func (*NewMessage) ProtoMessage() {}
-func (this *NewMessage) GetNested() *NewMessage_Nested {
- if this != nil {
- return this.Nested
+func (m *NewMessage) GetNested() *NewMessage_Nested {
+ if m != nil {
+ return m.Nested
}
return nil
}
@@ -880,20 +1080,20 @@ type NewMessage_Nested struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *NewMessage_Nested) Reset() { *this = NewMessage_Nested{} }
-func (this *NewMessage_Nested) String() string { return proto.CompactTextString(this) }
-func (*NewMessage_Nested) ProtoMessage() {}
+func (m *NewMessage_Nested) Reset() { *m = NewMessage_Nested{} }
+func (m *NewMessage_Nested) String() string { return proto.CompactTextString(m) }
+func (*NewMessage_Nested) ProtoMessage() {}
-func (this *NewMessage_Nested) GetName() string {
- if this != nil && this.Name != nil {
- return *this.Name
+func (m *NewMessage_Nested) GetName() string {
+ if m != nil && m.Name != nil {
+ return *m.Name
}
return ""
}
-func (this *NewMessage_Nested) GetFoodGroup() string {
- if this != nil && this.FoodGroup != nil {
- return *this.FoodGroup
+func (m *NewMessage_Nested) GetFoodGroup() string {
+ if m != nil && m.FoodGroup != nil {
+ return *m.FoodGroup
}
return ""
}
@@ -905,29 +1105,29 @@ type InnerMessage struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *InnerMessage) Reset() { *this = InnerMessage{} }
-func (this *InnerMessage) String() string { return proto.CompactTextString(this) }
-func (*InnerMessage) ProtoMessage() {}
+func (m *InnerMessage) Reset() { *m = InnerMessage{} }
+func (m *InnerMessage) String() string { return proto.CompactTextString(m) }
+func (*InnerMessage) ProtoMessage() {}
const Default_InnerMessage_Port int32 = 4000
-func (this *InnerMessage) GetHost() string {
- if this != nil && this.Host != nil {
- return *this.Host
+func (m *InnerMessage) GetHost() string {
+ if m != nil && m.Host != nil {
+ return *m.Host
}
return ""
}
-func (this *InnerMessage) GetPort() int32 {
- if this != nil && this.Port != nil {
- return *this.Port
+func (m *InnerMessage) GetPort() int32 {
+ if m != nil && m.Port != nil {
+ return *m.Port
}
return Default_InnerMessage_Port
}
-func (this *InnerMessage) GetConnected() bool {
- if this != nil && this.Connected != nil {
- return *this.Connected
+func (m *InnerMessage) GetConnected() bool {
+ if m != nil && m.Connected != nil {
+ return *m.Connected
}
return false
}
@@ -940,34 +1140,34 @@ type OtherMessage struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *OtherMessage) Reset() { *this = OtherMessage{} }
-func (this *OtherMessage) String() string { return proto.CompactTextString(this) }
-func (*OtherMessage) ProtoMessage() {}
+func (m *OtherMessage) Reset() { *m = OtherMessage{} }
+func (m *OtherMessage) String() string { return proto.CompactTextString(m) }
+func (*OtherMessage) ProtoMessage() {}
-func (this *OtherMessage) GetKey() int64 {
- if this != nil && this.Key != nil {
- return *this.Key
+func (m *OtherMessage) GetKey() int64 {
+ if m != nil && m.Key != nil {
+ return *m.Key
}
return 0
}
-func (this *OtherMessage) GetValue() []byte {
- if this != nil {
- return this.Value
+func (m *OtherMessage) GetValue() []byte {
+ if m != nil {
+ return m.Value
}
return nil
}
-func (this *OtherMessage) GetWeight() float32 {
- if this != nil && this.Weight != nil {
- return *this.Weight
+func (m *OtherMessage) GetWeight() float32 {
+ if m != nil && m.Weight != nil {
+ return *m.Weight
}
return 0
}
-func (this *OtherMessage) GetInner() *InnerMessage {
- if this != nil {
- return this.Inner
+func (m *OtherMessage) GetInner() *InnerMessage {
+ if m != nil {
+ return m.Inner
}
return nil
}
@@ -987,9 +1187,9 @@ type MyMessage struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *MyMessage) Reset() { *this = MyMessage{} }
-func (this *MyMessage) String() string { return proto.CompactTextString(this) }
-func (*MyMessage) ProtoMessage() {}
+func (m *MyMessage) Reset() { *m = MyMessage{} }
+func (m *MyMessage) String() string { return proto.CompactTextString(m) }
+func (*MyMessage) ProtoMessage() {}
var extRange_MyMessage = []proto.ExtensionRange{
{100, 536870911},
@@ -998,71 +1198,93 @@ var extRange_MyMessage = []proto.ExtensionRange{
func (*MyMessage) ExtensionRangeArray() []proto.ExtensionRange {
return extRange_MyMessage
}
-func (this *MyMessage) ExtensionMap() map[int32]proto.Extension {
- if this.XXX_extensions == nil {
- this.XXX_extensions = make(map[int32]proto.Extension)
+func (m *MyMessage) ExtensionMap() map[int32]proto.Extension {
+ if m.XXX_extensions == nil {
+ m.XXX_extensions = make(map[int32]proto.Extension)
}
- return this.XXX_extensions
+ return m.XXX_extensions
}
-func (this *MyMessage) GetCount() int32 {
- if this != nil && this.Count != nil {
- return *this.Count
+func (m *MyMessage) GetCount() int32 {
+ if m != nil && m.Count != nil {
+ return *m.Count
}
return 0
}
-func (this *MyMessage) GetName() string {
- if this != nil && this.Name != nil {
- return *this.Name
+func (m *MyMessage) GetName() string {
+ if m != nil && m.Name != nil {
+ return *m.Name
}
return ""
}
-func (this *MyMessage) GetQuote() string {
- if this != nil && this.Quote != nil {
- return *this.Quote
+func (m *MyMessage) GetQuote() string {
+ if m != nil && m.Quote != nil {
+ return *m.Quote
}
return ""
}
-func (this *MyMessage) GetInner() *InnerMessage {
- if this != nil {
- return this.Inner
+func (m *MyMessage) GetPet() []string {
+ if m != nil {
+ return m.Pet
}
return nil
}
-func (this *MyMessage) GetBikeshed() MyMessage_Color {
- if this != nil && this.Bikeshed != nil {
- return *this.Bikeshed
+func (m *MyMessage) GetInner() *InnerMessage {
+ if m != nil {
+ return m.Inner
+ }
+ return nil
+}
+
+func (m *MyMessage) GetOthers() []*OtherMessage {
+ if m != nil {
+ return m.Others
+ }
+ return nil
+}
+
+func (m *MyMessage) GetBikeshed() MyMessage_Color {
+ if m != nil && m.Bikeshed != nil {
+ return *m.Bikeshed
}
return 0
}
-func (this *MyMessage) GetSomegroup() *MyMessage_SomeGroup {
- if this != nil {
- return this.Somegroup
+func (m *MyMessage) GetSomegroup() *MyMessage_SomeGroup {
+ if m != nil {
+ return m.Somegroup
}
return nil
}
-func (this *MyMessage) GetBigfloat() float64 {
- if this != nil && this.Bigfloat != nil {
- return *this.Bigfloat
+func (m *MyMessage) GetRepBytes() [][]byte {
+ if m != nil {
+ return m.RepBytes
+ }
+ return nil
+}
+
+func (m *MyMessage) GetBigfloat() float64 {
+ if m != nil && m.Bigfloat != nil {
+ return *m.Bigfloat
}
return 0
}
type MyMessage_SomeGroup struct {
- GroupField *int32 `protobuf:"varint,9,opt,name=group_field" json:"group_field,omitempty"`
+ GroupField *int32 `protobuf:"varint,9,opt,name=group_field" json:"group_field,omitempty"`
+ XXX_unrecognized []byte `json:"-"`
}
-func (this *MyMessage_SomeGroup) Reset() { *this = MyMessage_SomeGroup{} }
+func (m *MyMessage_SomeGroup) Reset() { *m = MyMessage_SomeGroup{} }
-func (this *MyMessage_SomeGroup) GetGroupField() int32 {
- if this != nil && this.GroupField != nil {
- return *this.GroupField
+func (m *MyMessage_SomeGroup) GetGroupField() int32 {
+ if m != nil && m.GroupField != nil {
+ return *m.GroupField
}
return 0
}
@@ -1072,13 +1294,13 @@ type Ext struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *Ext) Reset() { *this = Ext{} }
-func (this *Ext) String() string { return proto.CompactTextString(this) }
-func (*Ext) ProtoMessage() {}
+func (m *Ext) Reset() { *m = Ext{} }
+func (m *Ext) String() string { return proto.CompactTextString(m) }
+func (*Ext) ProtoMessage() {}
-func (this *Ext) GetData() string {
- if this != nil && this.Data != nil {
- return *this.Data
+func (m *Ext) GetData() string {
+ if m != nil && m.Data != nil {
+ return *m.Data
}
return ""
}
@@ -1112,27 +1334,35 @@ type MessageList struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *MessageList) Reset() { *this = MessageList{} }
-func (this *MessageList) String() string { return proto.CompactTextString(this) }
-func (*MessageList) ProtoMessage() {}
+func (m *MessageList) Reset() { *m = MessageList{} }
+func (m *MessageList) String() string { return proto.CompactTextString(m) }
+func (*MessageList) ProtoMessage() {}
+
+func (m *MessageList) GetMessage() []*MessageList_Message {
+ if m != nil {
+ return m.Message
+ }
+ return nil
+}
type MessageList_Message struct {
- Name *string `protobuf:"bytes,2,req,name=name" json:"name,omitempty"`
- Count *int32 `protobuf:"varint,3,req,name=count" json:"count,omitempty"`
+ Name *string `protobuf:"bytes,2,req,name=name" json:"name,omitempty"`
+ Count *int32 `protobuf:"varint,3,req,name=count" json:"count,omitempty"`
+ XXX_unrecognized []byte `json:"-"`
}
-func (this *MessageList_Message) Reset() { *this = MessageList_Message{} }
+func (m *MessageList_Message) Reset() { *m = MessageList_Message{} }
-func (this *MessageList_Message) GetName() string {
- if this != nil && this.Name != nil {
- return *this.Name
+func (m *MessageList_Message) GetName() string {
+ if m != nil && m.Name != nil {
+ return *m.Name
}
return ""
}
-func (this *MessageList_Message) GetCount() int32 {
- if this != nil && this.Count != nil {
- return *this.Count
+func (m *MessageList_Message) GetCount() int32 {
+ if m != nil && m.Count != nil {
+ return *m.Count
}
return 0
}
@@ -1143,20 +1373,20 @@ type Strings struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *Strings) Reset() { *this = Strings{} }
-func (this *Strings) String() string { return proto.CompactTextString(this) }
-func (*Strings) ProtoMessage() {}
+func (m *Strings) Reset() { *m = Strings{} }
+func (m *Strings) String() string { return proto.CompactTextString(m) }
+func (*Strings) ProtoMessage() {}
-func (this *Strings) GetStringField() string {
- if this != nil && this.StringField != nil {
- return *this.StringField
+func (m *Strings) GetStringField() string {
+ if m != nil && m.StringField != nil {
+ return *m.StringField
}
return ""
}
-func (this *Strings) GetBytesField() []byte {
- if this != nil {
- return this.BytesField
+func (m *Strings) GetBytesField() []byte {
+ if m != nil {
+ return m.BytesField
}
return nil
}
@@ -1183,9 +1413,9 @@ type Defaults struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *Defaults) Reset() { *this = Defaults{} }
-func (this *Defaults) String() string { return proto.CompactTextString(this) }
-func (*Defaults) ProtoMessage() {}
+func (m *Defaults) Reset() { *m = Defaults{} }
+func (m *Defaults) String() string { return proto.CompactTextString(m) }
+func (*Defaults) ProtoMessage() {}
const Default_Defaults_F_Bool bool = true
const Default_Defaults_F_Int32 int32 = 32
@@ -1208,128 +1438,128 @@ var Default_Defaults_F_Pinf float32 = float32(math.Inf(1))
var Default_Defaults_F_Ninf float32 = float32(math.Inf(-1))
var Default_Defaults_F_Nan float32 = float32(math.NaN())
-func (this *Defaults) GetF_Bool() bool {
- if this != nil && this.F_Bool != nil {
- return *this.F_Bool
+func (m *Defaults) GetF_Bool() bool {
+ if m != nil && m.F_Bool != nil {
+ return *m.F_Bool
}
return Default_Defaults_F_Bool
}
-func (this *Defaults) GetF_Int32() int32 {
- if this != nil && this.F_Int32 != nil {
- return *this.F_Int32
+func (m *Defaults) GetF_Int32() int32 {
+ if m != nil && m.F_Int32 != nil {
+ return *m.F_Int32
}
return Default_Defaults_F_Int32
}
-func (this *Defaults) GetF_Int64() int64 {
- if this != nil && this.F_Int64 != nil {
- return *this.F_Int64
+func (m *Defaults) GetF_Int64() int64 {
+ if m != nil && m.F_Int64 != nil {
+ return *m.F_Int64
}
return Default_Defaults_F_Int64
}
-func (this *Defaults) GetF_Fixed32() uint32 {
- if this != nil && this.F_Fixed32 != nil {
- return *this.F_Fixed32
+func (m *Defaults) GetF_Fixed32() uint32 {
+ if m != nil && m.F_Fixed32 != nil {
+ return *m.F_Fixed32
}
return Default_Defaults_F_Fixed32
}
-func (this *Defaults) GetF_Fixed64() uint64 {
- if this != nil && this.F_Fixed64 != nil {
- return *this.F_Fixed64
+func (m *Defaults) GetF_Fixed64() uint64 {
+ if m != nil && m.F_Fixed64 != nil {
+ return *m.F_Fixed64
}
return Default_Defaults_F_Fixed64
}
-func (this *Defaults) GetF_Uint32() uint32 {
- if this != nil && this.F_Uint32 != nil {
- return *this.F_Uint32
+func (m *Defaults) GetF_Uint32() uint32 {
+ if m != nil && m.F_Uint32 != nil {
+ return *m.F_Uint32
}
return Default_Defaults_F_Uint32
}
-func (this *Defaults) GetF_Uint64() uint64 {
- if this != nil && this.F_Uint64 != nil {
- return *this.F_Uint64
+func (m *Defaults) GetF_Uint64() uint64 {
+ if m != nil && m.F_Uint64 != nil {
+ return *m.F_Uint64
}
return Default_Defaults_F_Uint64
}
-func (this *Defaults) GetF_Float() float32 {
- if this != nil && this.F_Float != nil {
- return *this.F_Float
+func (m *Defaults) GetF_Float() float32 {
+ if m != nil && m.F_Float != nil {
+ return *m.F_Float
}
return Default_Defaults_F_Float
}
-func (this *Defaults) GetF_Double() float64 {
- if this != nil && this.F_Double != nil {
- return *this.F_Double
+func (m *Defaults) GetF_Double() float64 {
+ if m != nil && m.F_Double != nil {
+ return *m.F_Double
}
return Default_Defaults_F_Double
}
-func (this *Defaults) GetF_String() string {
- if this != nil && this.F_String != nil {
- return *this.F_String
+func (m *Defaults) GetF_String() string {
+ if m != nil && m.F_String != nil {
+ return *m.F_String
}
return Default_Defaults_F_String
}
-func (this *Defaults) GetF_Bytes() []byte {
- if this != nil && this.F_Bytes != nil {
- return this.F_Bytes
+func (m *Defaults) GetF_Bytes() []byte {
+ if m != nil && m.F_Bytes != nil {
+ return m.F_Bytes
}
return append([]byte(nil), Default_Defaults_F_Bytes...)
}
-func (this *Defaults) GetF_Sint32() int32 {
- if this != nil && this.F_Sint32 != nil {
- return *this.F_Sint32
+func (m *Defaults) GetF_Sint32() int32 {
+ if m != nil && m.F_Sint32 != nil {
+ return *m.F_Sint32
}
return Default_Defaults_F_Sint32
}
-func (this *Defaults) GetF_Sint64() int64 {
- if this != nil && this.F_Sint64 != nil {
- return *this.F_Sint64
+func (m *Defaults) GetF_Sint64() int64 {
+ if m != nil && m.F_Sint64 != nil {
+ return *m.F_Sint64
}
return Default_Defaults_F_Sint64
}
-func (this *Defaults) GetF_Enum() Defaults_Color {
- if this != nil && this.F_Enum != nil {
- return *this.F_Enum
+func (m *Defaults) GetF_Enum() Defaults_Color {
+ if m != nil && m.F_Enum != nil {
+ return *m.F_Enum
}
return Default_Defaults_F_Enum
}
-func (this *Defaults) GetF_Pinf() float32 {
- if this != nil && this.F_Pinf != nil {
- return *this.F_Pinf
+func (m *Defaults) GetF_Pinf() float32 {
+ if m != nil && m.F_Pinf != nil {
+ return *m.F_Pinf
}
return Default_Defaults_F_Pinf
}
-func (this *Defaults) GetF_Ninf() float32 {
- if this != nil && this.F_Ninf != nil {
- return *this.F_Ninf
+func (m *Defaults) GetF_Ninf() float32 {
+ if m != nil && m.F_Ninf != nil {
+ return *m.F_Ninf
}
return Default_Defaults_F_Ninf
}
-func (this *Defaults) GetF_Nan() float32 {
- if this != nil && this.F_Nan != nil {
- return *this.F_Nan
+func (m *Defaults) GetF_Nan() float32 {
+ if m != nil && m.F_Nan != nil {
+ return *m.F_Nan
}
return Default_Defaults_F_Nan
}
-func (this *Defaults) GetSub() *SubDefaults {
- if this != nil {
- return this.Sub
+func (m *Defaults) GetSub() *SubDefaults {
+ if m != nil {
+ return m.Sub
}
return nil
}
@@ -1339,15 +1569,15 @@ type SubDefaults struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *SubDefaults) Reset() { *this = SubDefaults{} }
-func (this *SubDefaults) String() string { return proto.CompactTextString(this) }
-func (*SubDefaults) ProtoMessage() {}
+func (m *SubDefaults) Reset() { *m = SubDefaults{} }
+func (m *SubDefaults) String() string { return proto.CompactTextString(m) }
+func (*SubDefaults) ProtoMessage() {}
const Default_SubDefaults_N int64 = 7
-func (this *SubDefaults) GetN() int64 {
- if this != nil && this.N != nil {
- return *this.N
+func (m *SubDefaults) GetN() int64 {
+ if m != nil && m.N != nil {
+ return *m.N
}
return Default_SubDefaults_N
}
@@ -1357,9 +1587,16 @@ type RepeatedEnum struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *RepeatedEnum) Reset() { *this = RepeatedEnum{} }
-func (this *RepeatedEnum) String() string { return proto.CompactTextString(this) }
-func (*RepeatedEnum) ProtoMessage() {}
+func (m *RepeatedEnum) Reset() { *m = RepeatedEnum{} }
+func (m *RepeatedEnum) String() string { return proto.CompactTextString(m) }
+func (*RepeatedEnum) ProtoMessage() {}
+
+func (m *RepeatedEnum) GetColor() []RepeatedEnum_Color {
+ if m != nil {
+ return m.Color
+ }
+ return nil
+}
type MoreRepeated struct {
Bools []bool `protobuf:"varint,1,rep,name=bools" json:"bools,omitempty"`
@@ -1370,9 +1607,44 @@ type MoreRepeated struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *MoreRepeated) Reset() { *this = MoreRepeated{} }
-func (this *MoreRepeated) String() string { return proto.CompactTextString(this) }
-func (*MoreRepeated) ProtoMessage() {}
+func (m *MoreRepeated) Reset() { *m = MoreRepeated{} }
+func (m *MoreRepeated) String() string { return proto.CompactTextString(m) }
+func (*MoreRepeated) ProtoMessage() {}
+
+func (m *MoreRepeated) GetBools() []bool {
+ if m != nil {
+ return m.Bools
+ }
+ return nil
+}
+
+func (m *MoreRepeated) GetBoolsPacked() []bool {
+ if m != nil {
+ return m.BoolsPacked
+ }
+ return nil
+}
+
+func (m *MoreRepeated) GetInts() []int32 {
+ if m != nil {
+ return m.Ints
+ }
+ return nil
+}
+
+func (m *MoreRepeated) GetIntsPacked() []int32 {
+ if m != nil {
+ return m.IntsPacked
+ }
+ return nil
+}
+
+func (m *MoreRepeated) GetStrings() []string {
+ if m != nil {
+ return m.Strings
+ }
+ return nil
+}
var E_Greeting = &proto.ExtensionDesc{
ExtendedType: (*MyMessage)(nil),
diff --git a/protoc-gen-go/descriptor/descriptor.pb.go b/protoc-gen-go/descriptor/descriptor.pb.go
index a984499..8aeed16 100644
--- a/protoc-gen-go/descriptor/descriptor.pb.go
+++ b/protoc-gen-go/descriptor/descriptor.pb.go
@@ -219,9 +219,16 @@ type FileDescriptorSet struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *FileDescriptorSet) Reset() { *this = FileDescriptorSet{} }
-func (this *FileDescriptorSet) String() string { return proto.CompactTextString(this) }
-func (*FileDescriptorSet) ProtoMessage() {}
+func (m *FileDescriptorSet) Reset() { *m = FileDescriptorSet{} }
+func (m *FileDescriptorSet) String() string { return proto.CompactTextString(m) }
+func (*FileDescriptorSet) ProtoMessage() {}
+
+func (m *FileDescriptorSet) GetFile() []*FileDescriptorProto {
+ if m != nil {
+ return m.File
+ }
+ return nil
+}
type FileDescriptorProto struct {
Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
@@ -237,27 +244,76 @@ type FileDescriptorProto struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *FileDescriptorProto) Reset() { *this = FileDescriptorProto{} }
-func (this *FileDescriptorProto) String() string { return proto.CompactTextString(this) }
-func (*FileDescriptorProto) ProtoMessage() {}
+func (m *FileDescriptorProto) Reset() { *m = FileDescriptorProto{} }
+func (m *FileDescriptorProto) String() string { return proto.CompactTextString(m) }
+func (*FileDescriptorProto) ProtoMessage() {}
-func (this *FileDescriptorProto) GetName() string {
- if this != nil && this.Name != nil {
- return *this.Name
+func (m *FileDescriptorProto) GetName() string {
+ if m != nil && m.Name != nil {
+ return *m.Name
}
return ""
}
-func (this *FileDescriptorProto) GetPackage() string {
- if this != nil && this.Package != nil {
- return *this.Package
+func (m *FileDescriptorProto) GetPackage() string {
+ if m != nil && m.Package != nil {
+ return *m.Package
}
return ""
}
-func (this *FileDescriptorProto) GetOptions() *FileOptions {
- if this != nil {
- return this.Options
+func (m *FileDescriptorProto) GetDependency() []string {
+ if m != nil {
+ return m.Dependency
+ }
+ return nil
+}
+
+func (m *FileDescriptorProto) GetPublicDependency() []int32 {
+ if m != nil {
+ return m.PublicDependency
+ }
+ return nil
+}
+
+func (m *FileDescriptorProto) GetWeakDependency() []int32 {
+ if m != nil {
+ return m.WeakDependency
+ }
+ return nil
+}
+
+func (m *FileDescriptorProto) GetMessageType() []*DescriptorProto {
+ if m != nil {
+ return m.MessageType
+ }
+ return nil
+}
+
+func (m *FileDescriptorProto) GetEnumType() []*EnumDescriptorProto {
+ if m != nil {
+ return m.EnumType
+ }
+ return nil
+}
+
+func (m *FileDescriptorProto) GetService() []*ServiceDescriptorProto {
+ if m != nil {
+ return m.Service
+ }
+ return nil
+}
+
+func (m *FileDescriptorProto) GetExtension() []*FieldDescriptorProto {
+ if m != nil {
+ return m.Extension
+ }
+ return nil
+}
+
+func (m *FileDescriptorProto) GetOptions() *FileOptions {
+ if m != nil {
+ return m.Options
}
return nil
}
@@ -273,20 +329,55 @@ type DescriptorProto struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *DescriptorProto) Reset() { *this = DescriptorProto{} }
-func (this *DescriptorProto) String() string { return proto.CompactTextString(this) }
-func (*DescriptorProto) ProtoMessage() {}
+func (m *DescriptorProto) Reset() { *m = DescriptorProto{} }
+func (m *DescriptorProto) String() string { return proto.CompactTextString(m) }
+func (*DescriptorProto) ProtoMessage() {}
-func (this *DescriptorProto) GetName() string {
- if this != nil && this.Name != nil {
- return *this.Name
+func (m *DescriptorProto) GetName() string {
+ if m != nil && m.Name != nil {
+ return *m.Name
}
return ""
}
-func (this *DescriptorProto) GetOptions() *MessageOptions {
- if this != nil {
- return this.Options
+func (m *DescriptorProto) GetField() []*FieldDescriptorProto {
+ if m != nil {
+ return m.Field
+ }
+ return nil
+}
+
+func (m *DescriptorProto) GetExtension() []*FieldDescriptorProto {
+ if m != nil {
+ return m.Extension
+ }
+ return nil
+}
+
+func (m *DescriptorProto) GetNestedType() []*DescriptorProto {
+ if m != nil {
+ return m.NestedType
+ }
+ return nil
+}
+
+func (m *DescriptorProto) GetEnumType() []*EnumDescriptorProto {
+ if m != nil {
+ return m.EnumType
+ }
+ return nil
+}
+
+func (m *DescriptorProto) GetExtensionRange() []*DescriptorProto_ExtensionRange {
+ if m != nil {
+ return m.ExtensionRange
+ }
+ return nil
+}
+
+func (m *DescriptorProto) GetOptions() *MessageOptions {
+ if m != nil {
+ return m.Options
}
return nil
}
@@ -297,20 +388,20 @@ type DescriptorProto_ExtensionRange struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *DescriptorProto_ExtensionRange) Reset() { *this = DescriptorProto_ExtensionRange{} }
-func (this *DescriptorProto_ExtensionRange) String() string { return proto.CompactTextString(this) }
-func (*DescriptorProto_ExtensionRange) ProtoMessage() {}
+func (m *DescriptorProto_ExtensionRange) Reset() { *m = DescriptorProto_ExtensionRange{} }
+func (m *DescriptorProto_ExtensionRange) String() string { return proto.CompactTextString(m) }
+func (*DescriptorProto_ExtensionRange) ProtoMessage() {}
-func (this *DescriptorProto_ExtensionRange) GetStart() int32 {
- if this != nil && this.Start != nil {
- return *this.Start
+func (m *DescriptorProto_ExtensionRange) GetStart() int32 {
+ if m != nil && m.Start != nil {
+ return *m.Start
}
return 0
}
-func (this *DescriptorProto_ExtensionRange) GetEnd() int32 {
- if this != nil && this.End != nil {
- return *this.End
+func (m *DescriptorProto_ExtensionRange) GetEnd() int32 {
+ if m != nil && m.End != nil {
+ return *m.End
}
return 0
}
@@ -327,62 +418,62 @@ type FieldDescriptorProto struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *FieldDescriptorProto) Reset() { *this = FieldDescriptorProto{} }
-func (this *FieldDescriptorProto) String() string { return proto.CompactTextString(this) }
-func (*FieldDescriptorProto) ProtoMessage() {}
+func (m *FieldDescriptorProto) Reset() { *m = FieldDescriptorProto{} }
+func (m *FieldDescriptorProto) String() string { return proto.CompactTextString(m) }
+func (*FieldDescriptorProto) ProtoMessage() {}
-func (this *FieldDescriptorProto) GetName() string {
- if this != nil && this.Name != nil {
- return *this.Name
+func (m *FieldDescriptorProto) GetName() string {
+ if m != nil && m.Name != nil {
+ return *m.Name
}
return ""
}
-func (this *FieldDescriptorProto) GetNumber() int32 {
- if this != nil && this.Number != nil {
- return *this.Number
+func (m *FieldDescriptorProto) GetNumber() int32 {
+ if m != nil && m.Number != nil {
+ return *m.Number
}
return 0
}
-func (this *FieldDescriptorProto) GetLabel() FieldDescriptorProto_Label {
- if this != nil && this.Label != nil {
- return *this.Label
+func (m *FieldDescriptorProto) GetLabel() FieldDescriptorProto_Label {
+ if m != nil && m.Label != nil {
+ return *m.Label
}
return 0
}
-func (this *FieldDescriptorProto) GetType() FieldDescriptorProto_Type {
- if this != nil && this.Type != nil {
- return *this.Type
+func (m *FieldDescriptorProto) GetType() FieldDescriptorProto_Type {
+ if m != nil && m.Type != nil {
+ return *m.Type
}
return 0
}
-func (this *FieldDescriptorProto) GetTypeName() string {
- if this != nil && this.TypeName != nil {
- return *this.TypeName
+func (m *FieldDescriptorProto) GetTypeName() string {
+ if m != nil && m.TypeName != nil {
+ return *m.TypeName
}
return ""
}
-func (this *FieldDescriptorProto) GetExtendee() string {
- if this != nil && this.Extendee != nil {
- return *this.Extendee
+func (m *FieldDescriptorProto) GetExtendee() string {
+ if m != nil && m.Extendee != nil {
+ return *m.Extendee
}
return ""
}
-func (this *FieldDescriptorProto) GetDefaultValue() string {
- if this != nil && this.DefaultValue != nil {
- return *this.DefaultValue
+func (m *FieldDescriptorProto) GetDefaultValue() string {
+ if m != nil && m.DefaultValue != nil {
+ return *m.DefaultValue
}
return ""
}
-func (this *FieldDescriptorProto) GetOptions() *FieldOptions {
- if this != nil {
- return this.Options
+func (m *FieldDescriptorProto) GetOptions() *FieldOptions {
+ if m != nil {
+ return m.Options
}
return nil
}
@@ -394,20 +485,27 @@ type EnumDescriptorProto struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *EnumDescriptorProto) Reset() { *this = EnumDescriptorProto{} }
-func (this *EnumDescriptorProto) String() string { return proto.CompactTextString(this) }
-func (*EnumDescriptorProto) ProtoMessage() {}
+func (m *EnumDescriptorProto) Reset() { *m = EnumDescriptorProto{} }
+func (m *EnumDescriptorProto) String() string { return proto.CompactTextString(m) }
+func (*EnumDescriptorProto) ProtoMessage() {}
-func (this *EnumDescriptorProto) GetName() string {
- if this != nil && this.Name != nil {
- return *this.Name
+func (m *EnumDescriptorProto) GetName() string {
+ if m != nil && m.Name != nil {
+ return *m.Name
}
return ""
}
-func (this *EnumDescriptorProto) GetOptions() *EnumOptions {
- if this != nil {
- return this.Options
+func (m *EnumDescriptorProto) GetValue() []*EnumValueDescriptorProto {
+ if m != nil {
+ return m.Value
+ }
+ return nil
+}
+
+func (m *EnumDescriptorProto) GetOptions() *EnumOptions {
+ if m != nil {
+ return m.Options
}
return nil
}
@@ -419,27 +517,27 @@ type EnumValueDescriptorProto struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *EnumValueDescriptorProto) Reset() { *this = EnumValueDescriptorProto{} }
-func (this *EnumValueDescriptorProto) String() string { return proto.CompactTextString(this) }
-func (*EnumValueDescriptorProto) ProtoMessage() {}
+func (m *EnumValueDescriptorProto) Reset() { *m = EnumValueDescriptorProto{} }
+func (m *EnumValueDescriptorProto) String() string { return proto.CompactTextString(m) }
+func (*EnumValueDescriptorProto) ProtoMessage() {}
-func (this *EnumValueDescriptorProto) GetName() string {
- if this != nil && this.Name != nil {
- return *this.Name
+func (m *EnumValueDescriptorProto) GetName() string {
+ if m != nil && m.Name != nil {
+ return *m.Name
}
return ""
}
-func (this *EnumValueDescriptorProto) GetNumber() int32 {
- if this != nil && this.Number != nil {
- return *this.Number
+func (m *EnumValueDescriptorProto) GetNumber() int32 {
+ if m != nil && m.Number != nil {
+ return *m.Number
}
return 0
}
-func (this *EnumValueDescriptorProto) GetOptions() *EnumValueOptions {
- if this != nil {
- return this.Options
+func (m *EnumValueDescriptorProto) GetOptions() *EnumValueOptions {
+ if m != nil {
+ return m.Options
}
return nil
}
@@ -451,20 +549,27 @@ type ServiceDescriptorProto struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *ServiceDescriptorProto) Reset() { *this = ServiceDescriptorProto{} }
-func (this *ServiceDescriptorProto) String() string { return proto.CompactTextString(this) }
-func (*ServiceDescriptorProto) ProtoMessage() {}
+func (m *ServiceDescriptorProto) Reset() { *m = ServiceDescriptorProto{} }
+func (m *ServiceDescriptorProto) String() string { return proto.CompactTextString(m) }
+func (*ServiceDescriptorProto) ProtoMessage() {}
-func (this *ServiceDescriptorProto) GetName() string {
- if this != nil && this.Name != nil {
- return *this.Name
+func (m *ServiceDescriptorProto) GetName() string {
+ if m != nil && m.Name != nil {
+ return *m.Name
}
return ""
}
-func (this *ServiceDescriptorProto) GetOptions() *ServiceOptions {
- if this != nil {
- return this.Options
+func (m *ServiceDescriptorProto) GetMethod() []*MethodDescriptorProto {
+ if m != nil {
+ return m.Method
+ }
+ return nil
+}
+
+func (m *ServiceDescriptorProto) GetOptions() *ServiceOptions {
+ if m != nil {
+ return m.Options
}
return nil
}
@@ -477,34 +582,34 @@ type MethodDescriptorProto struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *MethodDescriptorProto) Reset() { *this = MethodDescriptorProto{} }
-func (this *MethodDescriptorProto) String() string { return proto.CompactTextString(this) }
-func (*MethodDescriptorProto) ProtoMessage() {}
+func (m *MethodDescriptorProto) Reset() { *m = MethodDescriptorProto{} }
+func (m *MethodDescriptorProto) String() string { return proto.CompactTextString(m) }
+func (*MethodDescriptorProto) ProtoMessage() {}
-func (this *MethodDescriptorProto) GetName() string {
- if this != nil && this.Name != nil {
- return *this.Name
+func (m *MethodDescriptorProto) GetName() string {
+ if m != nil && m.Name != nil {
+ return *m.Name
}
return ""
}
-func (this *MethodDescriptorProto) GetInputType() string {
- if this != nil && this.InputType != nil {
- return *this.InputType
+func (m *MethodDescriptorProto) GetInputType() string {
+ if m != nil && m.InputType != nil {
+ return *m.InputType
}
return ""
}
-func (this *MethodDescriptorProto) GetOutputType() string {
- if this != nil && this.OutputType != nil {
- return *this.OutputType
+func (m *MethodDescriptorProto) GetOutputType() string {
+ if m != nil && m.OutputType != nil {
+ return *m.OutputType
}
return ""
}
-func (this *MethodDescriptorProto) GetOptions() *MethodOptions {
- if this != nil {
- return this.Options
+func (m *MethodDescriptorProto) GetOptions() *MethodOptions {
+ if m != nil {
+ return m.Options
}
return nil
}
@@ -522,9 +627,9 @@ type FileOptions struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *FileOptions) Reset() { *this = FileOptions{} }
-func (this *FileOptions) String() string { return proto.CompactTextString(this) }
-func (*FileOptions) ProtoMessage() {}
+func (m *FileOptions) Reset() { *m = FileOptions{} }
+func (m *FileOptions) String() string { return proto.CompactTextString(m) }
+func (*FileOptions) ProtoMessage() {}
var extRange_FileOptions = []proto.ExtensionRange{
{1000, 536870911},
@@ -533,11 +638,11 @@ var extRange_FileOptions = []proto.ExtensionRange{
func (*FileOptions) ExtensionRangeArray() []proto.ExtensionRange {
return extRange_FileOptions
}
-func (this *FileOptions) ExtensionMap() map[int32]proto.Extension {
- if this.XXX_extensions == nil {
- this.XXX_extensions = make(map[int32]proto.Extension)
+func (m *FileOptions) ExtensionMap() map[int32]proto.Extension {
+ if m.XXX_extensions == nil {
+ m.XXX_extensions = make(map[int32]proto.Extension)
}
- return this.XXX_extensions
+ return m.XXX_extensions
}
const Default_FileOptions_JavaMultipleFiles bool = false
@@ -546,55 +651,62 @@ const Default_FileOptions_CcGenericServices bool = true
const Default_FileOptions_JavaGenericServices bool = true
const Default_FileOptions_PyGenericServices bool = true
-func (this *FileOptions) GetJavaPackage() string {
- if this != nil && this.JavaPackage != nil {
- return *this.JavaPackage
+func (m *FileOptions) GetJavaPackage() string {
+ if m != nil && m.JavaPackage != nil {
+ return *m.JavaPackage
}
return ""
}
-func (this *FileOptions) GetJavaOuterClassname() string {
- if this != nil && this.JavaOuterClassname != nil {
- return *this.JavaOuterClassname
+func (m *FileOptions) GetJavaOuterClassname() string {
+ if m != nil && m.JavaOuterClassname != nil {
+ return *m.JavaOuterClassname
}
return ""
}
-func (this *FileOptions) GetJavaMultipleFiles() bool {
- if this != nil && this.JavaMultipleFiles != nil {
- return *this.JavaMultipleFiles
+func (m *FileOptions) GetJavaMultipleFiles() bool {
+ if m != nil && m.JavaMultipleFiles != nil {
+ return *m.JavaMultipleFiles
}
return Default_FileOptions_JavaMultipleFiles
}
-func (this *FileOptions) GetOptimizeFor() FileOptions_OptimizeMode {
- if this != nil && this.OptimizeFor != nil {
- return *this.OptimizeFor
+func (m *FileOptions) GetOptimizeFor() FileOptions_OptimizeMode {
+ if m != nil && m.OptimizeFor != nil {
+ return *m.OptimizeFor
}
return Default_FileOptions_OptimizeFor
}
-func (this *FileOptions) GetCcGenericServices() bool {
- if this != nil && this.CcGenericServices != nil {
- return *this.CcGenericServices
+func (m *FileOptions) GetCcGenericServices() bool {
+ if m != nil && m.CcGenericServices != nil {
+ return *m.CcGenericServices
}
return Default_FileOptions_CcGenericServices
}
-func (this *FileOptions) GetJavaGenericServices() bool {
- if this != nil && this.JavaGenericServices != nil {
- return *this.JavaGenericServices
+func (m *FileOptions) GetJavaGenericServices() bool {
+ if m != nil && m.JavaGenericServices != nil {
+ return *m.JavaGenericServices
}
return Default_FileOptions_JavaGenericServices
}
-func (this *FileOptions) GetPyGenericServices() bool {
- if this != nil && this.PyGenericServices != nil {
- return *this.PyGenericServices
+func (m *FileOptions) GetPyGenericServices() bool {
+ if m != nil && m.PyGenericServices != nil {
+ return *m.PyGenericServices
}
return Default_FileOptions_PyGenericServices
}
+func (m *FileOptions) GetUninterpretedOption() []*UninterpretedOption {
+ if m != nil {
+ return m.UninterpretedOption
+ }
+ return nil
+}
+
type MessageOptions struct {
MessageSetWireFormat *bool `protobuf:"varint,1,opt,name=message_set_wire_format,def=0" json:"message_set_wire_format,omitempty"`
NoStandardDescriptorAccessor *bool `protobuf:"varint,2,opt,name=no_standard_descriptor_accessor,def=0" json:"no_standard_descriptor_accessor,omitempty"`
@@ -603,9 +715,9 @@ type MessageOptions struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *MessageOptions) Reset() { *this = MessageOptions{} }
-func (this *MessageOptions) String() string { return proto.CompactTextString(this) }
-func (*MessageOptions) ProtoMessage() {}
+func (m *MessageOptions) Reset() { *m = MessageOptions{} }
+func (m *MessageOptions) String() string { return proto.CompactTextString(m) }
+func (*MessageOptions) ProtoMessage() {}
var extRange_MessageOptions = []proto.ExtensionRange{
{1000, 536870911},
@@ -614,30 +726,37 @@ var extRange_MessageOptions = []proto.ExtensionRange{
func (*MessageOptions) ExtensionRangeArray() []proto.ExtensionRange {
return extRange_MessageOptions
}
-func (this *MessageOptions) ExtensionMap() map[int32]proto.Extension {
- if this.XXX_extensions == nil {
- this.XXX_extensions = make(map[int32]proto.Extension)
+func (m *MessageOptions) ExtensionMap() map[int32]proto.Extension {
+ if m.XXX_extensions == nil {
+ m.XXX_extensions = make(map[int32]proto.Extension)
}
- return this.XXX_extensions
+ return m.XXX_extensions
}
const Default_MessageOptions_MessageSetWireFormat bool = false
const Default_MessageOptions_NoStandardDescriptorAccessor bool = false
-func (this *MessageOptions) GetMessageSetWireFormat() bool {
- if this != nil && this.MessageSetWireFormat != nil {
- return *this.MessageSetWireFormat
+func (m *MessageOptions) GetMessageSetWireFormat() bool {
+ if m != nil && m.MessageSetWireFormat != nil {
+ return *m.MessageSetWireFormat
}
return Default_MessageOptions_MessageSetWireFormat
}
-func (this *MessageOptions) GetNoStandardDescriptorAccessor() bool {
- if this != nil && this.NoStandardDescriptorAccessor != nil {
- return *this.NoStandardDescriptorAccessor
+func (m *MessageOptions) GetNoStandardDescriptorAccessor() bool {
+ if m != nil && m.NoStandardDescriptorAccessor != nil {
+ return *m.NoStandardDescriptorAccessor
}
return Default_MessageOptions_NoStandardDescriptorAccessor
}
+func (m *MessageOptions) GetUninterpretedOption() []*UninterpretedOption {
+ if m != nil {
+ return m.UninterpretedOption
+ }
+ return nil
+}
+
type FieldOptions struct {
Ctype *FieldOptions_CType `protobuf:"varint,1,opt,name=ctype,enum=google.protobuf.FieldOptions_CType,def=0" json:"ctype,omitempty"`
Packed *bool `protobuf:"varint,2,opt,name=packed" json:"packed,omitempty"`
@@ -648,9 +767,9 @@ type FieldOptions struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *FieldOptions) Reset() { *this = FieldOptions{} }
-func (this *FieldOptions) String() string { return proto.CompactTextString(this) }
-func (*FieldOptions) ProtoMessage() {}
+func (m *FieldOptions) Reset() { *m = FieldOptions{} }
+func (m *FieldOptions) String() string { return proto.CompactTextString(m) }
+func (*FieldOptions) ProtoMessage() {}
var extRange_FieldOptions = []proto.ExtensionRange{
{1000, 536870911},
@@ -659,53 +778,60 @@ var extRange_FieldOptions = []proto.ExtensionRange{
func (*FieldOptions) ExtensionRangeArray() []proto.ExtensionRange {
return extRange_FieldOptions
}
-func (this *FieldOptions) ExtensionMap() map[int32]proto.Extension {
- if this.XXX_extensions == nil {
- this.XXX_extensions = make(map[int32]proto.Extension)
+func (m *FieldOptions) ExtensionMap() map[int32]proto.Extension {
+ if m.XXX_extensions == nil {
+ m.XXX_extensions = make(map[int32]proto.Extension)
}
- return this.XXX_extensions
+ return m.XXX_extensions
}
const Default_FieldOptions_Ctype FieldOptions_CType = FieldOptions_STRING
const Default_FieldOptions_Deprecated bool = false
-func (this *FieldOptions) GetCtype() FieldOptions_CType {
- if this != nil && this.Ctype != nil {
- return *this.Ctype
+func (m *FieldOptions) GetCtype() FieldOptions_CType {
+ if m != nil && m.Ctype != nil {
+ return *m.Ctype
}
return Default_FieldOptions_Ctype
}
-func (this *FieldOptions) GetPacked() bool {
- if this != nil && this.Packed != nil {
- return *this.Packed
+func (m *FieldOptions) GetPacked() bool {
+ if m != nil && m.Packed != nil {
+ return *m.Packed
}
return false
}
-func (this *FieldOptions) GetDeprecated() bool {
- if this != nil && this.Deprecated != nil {
- return *this.Deprecated
+func (m *FieldOptions) GetDeprecated() bool {
+ if m != nil && m.Deprecated != nil {
+ return *m.Deprecated
}
return Default_FieldOptions_Deprecated
}
-func (this *FieldOptions) GetExperimentalMapKey() string {
- if this != nil && this.ExperimentalMapKey != nil {
- return *this.ExperimentalMapKey
+func (m *FieldOptions) GetExperimentalMapKey() string {
+ if m != nil && m.ExperimentalMapKey != nil {
+ return *m.ExperimentalMapKey
}
return ""
}
+func (m *FieldOptions) GetUninterpretedOption() []*UninterpretedOption {
+ if m != nil {
+ return m.UninterpretedOption
+ }
+ return nil
+}
+
type EnumOptions struct {
UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option" json:"uninterpreted_option,omitempty"`
XXX_extensions map[int32]proto.Extension `json:"-"`
XXX_unrecognized []byte `json:"-"`
}
-func (this *EnumOptions) Reset() { *this = EnumOptions{} }
-func (this *EnumOptions) String() string { return proto.CompactTextString(this) }
-func (*EnumOptions) ProtoMessage() {}
+func (m *EnumOptions) Reset() { *m = EnumOptions{} }
+func (m *EnumOptions) String() string { return proto.CompactTextString(m) }
+func (*EnumOptions) ProtoMessage() {}
var extRange_EnumOptions = []proto.ExtensionRange{
{1000, 536870911},
@@ -714,11 +840,18 @@ var extRange_EnumOptions = []proto.ExtensionRange{
func (*EnumOptions) ExtensionRangeArray() []proto.ExtensionRange {
return extRange_EnumOptions
}
-func (this *EnumOptions) ExtensionMap() map[int32]proto.Extension {
- if this.XXX_extensions == nil {
- this.XXX_extensions = make(map[int32]proto.Extension)
+func (m *EnumOptions) ExtensionMap() map[int32]proto.Extension {
+ if m.XXX_extensions == nil {
+ m.XXX_extensions = make(map[int32]proto.Extension)
+ }
+ return m.XXX_extensions
+}
+
+func (m *EnumOptions) GetUninterpretedOption() []*UninterpretedOption {
+ if m != nil {
+ return m.UninterpretedOption
}
- return this.XXX_extensions
+ return nil
}
type EnumValueOptions struct {
@@ -727,9 +860,9 @@ type EnumValueOptions struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *EnumValueOptions) Reset() { *this = EnumValueOptions{} }
-func (this *EnumValueOptions) String() string { return proto.CompactTextString(this) }
-func (*EnumValueOptions) ProtoMessage() {}
+func (m *EnumValueOptions) Reset() { *m = EnumValueOptions{} }
+func (m *EnumValueOptions) String() string { return proto.CompactTextString(m) }
+func (*EnumValueOptions) ProtoMessage() {}
var extRange_EnumValueOptions = []proto.ExtensionRange{
{1000, 536870911},
@@ -738,11 +871,18 @@ var extRange_EnumValueOptions = []proto.ExtensionRange{
func (*EnumValueOptions) ExtensionRangeArray() []proto.ExtensionRange {
return extRange_EnumValueOptions
}
-func (this *EnumValueOptions) ExtensionMap() map[int32]proto.Extension {
- if this.XXX_extensions == nil {
- this.XXX_extensions = make(map[int32]proto.Extension)
+func (m *EnumValueOptions) ExtensionMap() map[int32]proto.Extension {
+ if m.XXX_extensions == nil {
+ m.XXX_extensions = make(map[int32]proto.Extension)
+ }
+ return m.XXX_extensions
+}
+
+func (m *EnumValueOptions) GetUninterpretedOption() []*UninterpretedOption {
+ if m != nil {
+ return m.UninterpretedOption
}
- return this.XXX_extensions
+ return nil
}
type ServiceOptions struct {
@@ -751,9 +891,9 @@ type ServiceOptions struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *ServiceOptions) Reset() { *this = ServiceOptions{} }
-func (this *ServiceOptions) String() string { return proto.CompactTextString(this) }
-func (*ServiceOptions) ProtoMessage() {}
+func (m *ServiceOptions) Reset() { *m = ServiceOptions{} }
+func (m *ServiceOptions) String() string { return proto.CompactTextString(m) }
+func (*ServiceOptions) ProtoMessage() {}
var extRange_ServiceOptions = []proto.ExtensionRange{
{1000, 536870911},
@@ -762,11 +902,18 @@ var extRange_ServiceOptions = []proto.ExtensionRange{
func (*ServiceOptions) ExtensionRangeArray() []proto.ExtensionRange {
return extRange_ServiceOptions
}
-func (this *ServiceOptions) ExtensionMap() map[int32]proto.Extension {
- if this.XXX_extensions == nil {
- this.XXX_extensions = make(map[int32]proto.Extension)
+func (m *ServiceOptions) ExtensionMap() map[int32]proto.Extension {
+ if m.XXX_extensions == nil {
+ m.XXX_extensions = make(map[int32]proto.Extension)
}
- return this.XXX_extensions
+ return m.XXX_extensions
+}
+
+func (m *ServiceOptions) GetUninterpretedOption() []*UninterpretedOption {
+ if m != nil {
+ return m.UninterpretedOption
+ }
+ return nil
}
type MethodOptions struct {
@@ -775,9 +922,9 @@ type MethodOptions struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *MethodOptions) Reset() { *this = MethodOptions{} }
-func (this *MethodOptions) String() string { return proto.CompactTextString(this) }
-func (*MethodOptions) ProtoMessage() {}
+func (m *MethodOptions) Reset() { *m = MethodOptions{} }
+func (m *MethodOptions) String() string { return proto.CompactTextString(m) }
+func (*MethodOptions) ProtoMessage() {}
var extRange_MethodOptions = []proto.ExtensionRange{
{1000, 536870911},
@@ -786,11 +933,18 @@ var extRange_MethodOptions = []proto.ExtensionRange{
func (*MethodOptions) ExtensionRangeArray() []proto.ExtensionRange {
return extRange_MethodOptions
}
-func (this *MethodOptions) ExtensionMap() map[int32]proto.Extension {
- if this.XXX_extensions == nil {
- this.XXX_extensions = make(map[int32]proto.Extension)
+func (m *MethodOptions) ExtensionMap() map[int32]proto.Extension {
+ if m.XXX_extensions == nil {
+ m.XXX_extensions = make(map[int32]proto.Extension)
}
- return this.XXX_extensions
+ return m.XXX_extensions
+}
+
+func (m *MethodOptions) GetUninterpretedOption() []*UninterpretedOption {
+ if m != nil {
+ return m.UninterpretedOption
+ }
+ return nil
}
type UninterpretedOption struct {
@@ -803,41 +957,48 @@ type UninterpretedOption struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *UninterpretedOption) Reset() { *this = UninterpretedOption{} }
-func (this *UninterpretedOption) String() string { return proto.CompactTextString(this) }
-func (*UninterpretedOption) ProtoMessage() {}
+func (m *UninterpretedOption) Reset() { *m = UninterpretedOption{} }
+func (m *UninterpretedOption) String() string { return proto.CompactTextString(m) }
+func (*UninterpretedOption) ProtoMessage() {}
+
+func (m *UninterpretedOption) GetName() []*UninterpretedOption_NamePart {
+ if m != nil {
+ return m.Name
+ }
+ return nil
+}
-func (this *UninterpretedOption) GetIdentifierValue() string {
- if this != nil && this.IdentifierValue != nil {
- return *this.IdentifierValue
+func (m *UninterpretedOption) GetIdentifierValue() string {
+ if m != nil && m.IdentifierValue != nil {
+ return *m.IdentifierValue
}
return ""
}
-func (this *UninterpretedOption) GetPositiveIntValue() uint64 {
- if this != nil && this.PositiveIntValue != nil {
- return *this.PositiveIntValue
+func (m *UninterpretedOption) GetPositiveIntValue() uint64 {
+ if m != nil && m.PositiveIntValue != nil {
+ return *m.PositiveIntValue
}
return 0
}
-func (this *UninterpretedOption) GetNegativeIntValue() int64 {
- if this != nil && this.NegativeIntValue != nil {
- return *this.NegativeIntValue
+func (m *UninterpretedOption) GetNegativeIntValue() int64 {
+ if m != nil && m.NegativeIntValue != nil {
+ return *m.NegativeIntValue
}
return 0
}
-func (this *UninterpretedOption) GetDoubleValue() float64 {
- if this != nil && this.DoubleValue != nil {
- return *this.DoubleValue
+func (m *UninterpretedOption) GetDoubleValue() float64 {
+ if m != nil && m.DoubleValue != nil {
+ return *m.DoubleValue
}
return 0
}
-func (this *UninterpretedOption) GetStringValue() []byte {
- if this != nil {
- return this.StringValue
+func (m *UninterpretedOption) GetStringValue() []byte {
+ if m != nil {
+ return m.StringValue
}
return nil
}
@@ -848,20 +1009,20 @@ type UninterpretedOption_NamePart struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *UninterpretedOption_NamePart) Reset() { *this = UninterpretedOption_NamePart{} }
-func (this *UninterpretedOption_NamePart) String() string { return proto.CompactTextString(this) }
-func (*UninterpretedOption_NamePart) ProtoMessage() {}
+func (m *UninterpretedOption_NamePart) Reset() { *m = UninterpretedOption_NamePart{} }
+func (m *UninterpretedOption_NamePart) String() string { return proto.CompactTextString(m) }
+func (*UninterpretedOption_NamePart) ProtoMessage() {}
-func (this *UninterpretedOption_NamePart) GetNamePart() string {
- if this != nil && this.NamePart != nil {
- return *this.NamePart
+func (m *UninterpretedOption_NamePart) GetNamePart() string {
+ if m != nil && m.NamePart != nil {
+ return *m.NamePart
}
return ""
}
-func (this *UninterpretedOption_NamePart) GetIsExtension() bool {
- if this != nil && this.IsExtension != nil {
- return *this.IsExtension
+func (m *UninterpretedOption_NamePart) GetIsExtension() bool {
+ if m != nil && m.IsExtension != nil {
+ return *m.IsExtension
}
return false
}
diff --git a/protoc-gen-go/generator/generator.go b/protoc-gen-go/generator/generator.go
index e914453..c556e66 100644
--- a/protoc-gen-go/generator/generator.go
+++ b/protoc-gen-go/generator/generator.go
@@ -282,19 +282,19 @@ func (ms *messageSymbol) GenerateAlias(g *Generator, pkg string) {
remoteSym := pkg + "." + ms.sym
g.P("type ", ms.sym, " ", remoteSym)
- g.P("func (this *", ms.sym, ") Reset() { (*", remoteSym, ")(this).Reset() }")
- g.P("func (this *", ms.sym, ") String() string { return (*", remoteSym, ")(this).String() }")
+ g.P("func (m *", ms.sym, ") Reset() { (*", remoteSym, ")(m).Reset() }")
+ g.P("func (m *", ms.sym, ") String() string { return (*", remoteSym, ")(m).String() }")
g.P("func (*", ms.sym, ") ProtoMessage() {}")
if ms.hasExtensions {
g.P("func (*", ms.sym, ") ExtensionRangeArray() []", g.Pkg["proto"], ".ExtensionRange ",
"{ return (*", remoteSym, ")(nil).ExtensionRangeArray() }")
- g.P("func (this *", ms.sym, ") ExtensionMap() map[int32]", g.Pkg["proto"], ".Extension ",
- "{ return (*", remoteSym, ")(this).ExtensionMap() }")
+ g.P("func (m *", ms.sym, ") ExtensionMap() map[int32]", g.Pkg["proto"], ".Extension ",
+ "{ return (*", remoteSym, ")(m).ExtensionMap() }")
if ms.isMessageSet {
- g.P("func (this *", ms.sym, ") Marshal() ([]byte, error) ",
- "{ return (*", remoteSym, ")(this).Marshal() }")
- g.P("func (this *", ms.sym, ") Unmarshal(buf []byte) error ",
- "{ return (*", remoteSym, ")(this).Unmarshal(buf) }")
+ g.P("func (m *", ms.sym, ") Marshal() ([]byte, error) ",
+ "{ return (*", remoteSym, ")(m).Marshal() }")
+ g.P("func (m *", ms.sym, ") Unmarshal(buf []byte) error ",
+ "{ return (*", remoteSym, ")(m).Unmarshal(buf) }")
}
}
for _, get := range ms.getters {
@@ -302,7 +302,7 @@ func (ms *messageSymbol) GenerateAlias(g *Generator, pkg string) {
g.RecordTypeUse(get.typeName)
}
typ := get.typ
- val := "(*" + remoteSym + ")(this)." + get.name + "()"
+ val := "(*" + remoteSym + ")(m)." + get.name + "()"
if get.genType {
// typ will be "*pkg.T" (message/group) or "pkg.T" (enum).
// Either of those might have a "[]" prefix if it is repeated.
@@ -328,7 +328,7 @@ func (ms *messageSymbol) GenerateAlias(g *Generator, pkg string) {
ctyp = "(" + typ + ")"
}
- g.P("func (this *", ms.sym, ") ", get.name, "() []", typ, " {")
+ g.P("func (m *", ms.sym, ") ", get.name, "() []", typ, " {")
g.In()
g.P("o := ", val)
g.P("if o == nil {")
@@ -351,7 +351,7 @@ func (ms *messageSymbol) GenerateAlias(g *Generator, pkg string) {
val = "(" + typ + ")(" + val + ")"
}
- g.P("func (this *", ms.sym, ") ", get.name, "() ", typ, " { return ", val, " }")
+ g.P("func (m *", ms.sym, ") ", get.name, "() ", typ, " { return ", val, " }")
}
}
@@ -1359,35 +1359,36 @@ func (g *Generator) generateMessage(message *Descriptor) {
usedNames[n] = true
}
fieldNames := make(map[*descriptor.FieldDescriptorProto]string)
+ fieldGetterNames := make(map[*descriptor.FieldDescriptorProto]string)
g.P("type ", ccTypeName, " struct {")
g.In()
for _, field := range message.Field {
- fieldname := CamelCase(*field.Name)
- for usedNames[fieldname] {
- fieldname += "_"
+ fieldName := CamelCase(*field.Name)
+ for usedNames[fieldName] {
+ fieldName += "_"
}
- usedNames[fieldname] = true
- fieldNames[field] = fieldname
+ fieldGetterName := fieldName
+ usedNames[fieldName] = true
typename, wiretype := g.GoType(message, field)
jsonName := *field.Name
tag := fmt.Sprintf("protobuf:%s json:%q", g.goTag(field, wiretype), jsonName+",omitempty")
- g.P(fieldname, "\t", typename, "\t`", tag, "`")
+ fieldNames[field] = fieldName
+ fieldGetterNames[field] = fieldGetterName
+ g.P(fieldName, "\t", typename, "\t`", tag, "`")
g.RecordTypeUse(field.GetTypeName())
}
if len(message.ExtensionRange) > 0 {
g.P("XXX_extensions\t\tmap[int32]", g.Pkg["proto"], ".Extension `json:\"-\"`")
}
- if !message.group {
- g.P("XXX_unrecognized\t[]byte `json:\"-\"`")
- }
+ g.P("XXX_unrecognized\t[]byte `json:\"-\"`")
g.Out()
g.P("}")
// Reset, String and ProtoMessage methods.
- g.P("func (this *", ccTypeName, ") Reset() { *this = ", ccTypeName, "{} }")
+ g.P("func (m *", ccTypeName, ") Reset() { *m = ", ccTypeName, "{} }")
if !message.group {
- g.P("func (this *", ccTypeName, ") String() string { return ", g.Pkg["proto"], ".CompactTextString(this) }")
+ g.P("func (m *", ccTypeName, ") String() string { return ", g.Pkg["proto"], ".CompactTextString(m) }")
g.P("func (*", ccTypeName, ") ProtoMessage() {}")
}
@@ -1399,14 +1400,14 @@ func (g *Generator) generateMessage(message *Descriptor) {
if opts := message.Options; opts != nil && opts.GetMessageSetWireFormat() {
isMessageSet = true
g.P()
- g.P("func (this *", ccTypeName, ") Marshal() ([]byte, error) {")
+ g.P("func (m *", ccTypeName, ") Marshal() ([]byte, error) {")
g.In()
- g.P("return ", g.Pkg["proto"], ".MarshalMessageSet(this.ExtensionMap())")
+ g.P("return ", g.Pkg["proto"], ".MarshalMessageSet(m.ExtensionMap())")
g.Out()
g.P("}")
- g.P("func (this *", ccTypeName, ") Unmarshal(buf []byte) error {")
+ g.P("func (m *", ccTypeName, ") Unmarshal(buf []byte) error {")
g.In()
- g.P("return ", g.Pkg["proto"], ".UnmarshalMessageSet(buf, this.ExtensionMap())")
+ g.P("return ", g.Pkg["proto"], ".UnmarshalMessageSet(buf, m.ExtensionMap())")
g.Out()
g.P("}")
g.P("// ensure ", ccTypeName, " satisfies proto.Marshaler and proto.Unmarshaler")
@@ -1428,14 +1429,14 @@ func (g *Generator) generateMessage(message *Descriptor) {
g.P("return extRange_", ccTypeName)
g.Out()
g.P("}")
- g.P("func (this *", ccTypeName, ") ExtensionMap() map[int32]", g.Pkg["proto"], ".Extension {")
+ g.P("func (m *", ccTypeName, ") ExtensionMap() map[int32]", g.Pkg["proto"], ".Extension {")
g.In()
- g.P("if this.XXX_extensions == nil {")
+ g.P("if m.XXX_extensions == nil {")
g.In()
- g.P("this.XXX_extensions = make(map[int32]", g.Pkg["proto"], ".Extension)")
+ g.P("m.XXX_extensions = make(map[int32]", g.Pkg["proto"], ".Extension)")
g.Out()
g.P("}")
- g.P("return this.XXX_extensions")
+ g.P("return m.XXX_extensions")
g.Out()
g.P("}")
}
@@ -1495,7 +1496,7 @@ func (g *Generator) generateMessage(message *Descriptor) {
for _, field := range message.Field {
fname := fieldNames[field]
typename, _ := g.GoType(message, field)
- mname := "Get" + fname
+ mname := "Get" + fieldGetterNames[field]
star := ""
if needsStar(*field.Type) && typename[0] == '*' {
typename = typename[1:]
@@ -1532,7 +1533,7 @@ func (g *Generator) generateMessage(message *Descriptor) {
})
}
- g.P("func (this *", ccTypeName, ") "+mname+"() "+typename+" {")
+ g.P("func (m *", ccTypeName, ") "+mname+"() "+typename+" {")
g.In()
def, hasDef := defNames[field]
typeDefaultIsNil := false // whether this field type's default value is a literal nil unless specified
@@ -1548,9 +1549,9 @@ func (g *Generator) generateMessage(message *Descriptor) {
if typeDefaultIsNil {
// A bytes field with no explicit default needs less generated code,
// as does a message or group field, or a repeated field.
- g.P("if this != nil {")
+ g.P("if m != nil {")
g.In()
- g.P("return this." + fname)
+ g.P("return m." + fname)
g.Out()
g.P("}")
g.P("return nil")
@@ -1559,9 +1560,9 @@ func (g *Generator) generateMessage(message *Descriptor) {
g.P()
continue
}
- g.P("if this != nil && this." + fname + " != nil {")
+ g.P("if m != nil && m." + fname + " != nil {")
g.In()
- g.P("return " + star + "this." + fname)
+ g.P("return " + star + "m." + fname)
g.Out()
g.P("}")
if hasDef {
diff --git a/protoc-gen-go/plugin/plugin.pb.go b/protoc-gen-go/plugin/plugin.pb.go
index f8ba361..ccc2a4c 100644
--- a/protoc-gen-go/plugin/plugin.pb.go
+++ b/protoc-gen-go/plugin/plugin.pb.go
@@ -21,34 +21,55 @@ type CodeGeneratorRequest struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *CodeGeneratorRequest) Reset() { *this = CodeGeneratorRequest{} }
-func (this *CodeGeneratorRequest) String() string { return proto.CompactTextString(this) }
-func (*CodeGeneratorRequest) ProtoMessage() {}
+func (m *CodeGeneratorRequest) Reset() { *m = CodeGeneratorRequest{} }
+func (m *CodeGeneratorRequest) String() string { return proto.CompactTextString(m) }
+func (*CodeGeneratorRequest) ProtoMessage() {}
-func (this *CodeGeneratorRequest) GetParameter() string {
- if this != nil && this.Parameter != nil {
- return *this.Parameter
+func (m *CodeGeneratorRequest) GetFileToGenerate() []string {
+ if m != nil {
+ return m.FileToGenerate
+ }
+ return nil
+}
+
+func (m *CodeGeneratorRequest) GetParameter() string {
+ if m != nil && m.Parameter != nil {
+ return *m.Parameter
}
return ""
}
+func (m *CodeGeneratorRequest) GetProtoFile() []*google_protobuf.FileDescriptorProto {
+ if m != nil {
+ return m.ProtoFile
+ }
+ return nil
+}
+
type CodeGeneratorResponse struct {
Error *string `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"`
File []*CodeGeneratorResponse_File `protobuf:"bytes,15,rep,name=file" json:"file,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
-func (this *CodeGeneratorResponse) Reset() { *this = CodeGeneratorResponse{} }
-func (this *CodeGeneratorResponse) String() string { return proto.CompactTextString(this) }
-func (*CodeGeneratorResponse) ProtoMessage() {}
+func (m *CodeGeneratorResponse) Reset() { *m = CodeGeneratorResponse{} }
+func (m *CodeGeneratorResponse) String() string { return proto.CompactTextString(m) }
+func (*CodeGeneratorResponse) ProtoMessage() {}
-func (this *CodeGeneratorResponse) GetError() string {
- if this != nil && this.Error != nil {
- return *this.Error
+func (m *CodeGeneratorResponse) GetError() string {
+ if m != nil && m.Error != nil {
+ return *m.Error
}
return ""
}
+func (m *CodeGeneratorResponse) GetFile() []*CodeGeneratorResponse_File {
+ if m != nil {
+ return m.File
+ }
+ return nil
+}
+
type CodeGeneratorResponse_File struct {
Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
InsertionPoint *string `protobuf:"bytes,2,opt,name=insertion_point" json:"insertion_point,omitempty"`
@@ -56,27 +77,27 @@ type CodeGeneratorResponse_File struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *CodeGeneratorResponse_File) Reset() { *this = CodeGeneratorResponse_File{} }
-func (this *CodeGeneratorResponse_File) String() string { return proto.CompactTextString(this) }
-func (*CodeGeneratorResponse_File) ProtoMessage() {}
+func (m *CodeGeneratorResponse_File) Reset() { *m = CodeGeneratorResponse_File{} }
+func (m *CodeGeneratorResponse_File) String() string { return proto.CompactTextString(m) }
+func (*CodeGeneratorResponse_File) ProtoMessage() {}
-func (this *CodeGeneratorResponse_File) GetName() string {
- if this != nil && this.Name != nil {
- return *this.Name
+func (m *CodeGeneratorResponse_File) GetName() string {
+ if m != nil && m.Name != nil {
+ return *m.Name
}
return ""
}
-func (this *CodeGeneratorResponse_File) GetInsertionPoint() string {
- if this != nil && this.InsertionPoint != nil {
- return *this.InsertionPoint
+func (m *CodeGeneratorResponse_File) GetInsertionPoint() string {
+ if m != nil && m.InsertionPoint != nil {
+ return *m.InsertionPoint
}
return ""
}
-func (this *CodeGeneratorResponse_File) GetContent() string {
- if this != nil && this.Content != nil {
- return *this.Content
+func (m *CodeGeneratorResponse_File) GetContent() string {
+ if m != nil && m.Content != nil {
+ return *m.Content
}
return ""
}
diff --git a/protoc-gen-go/testdata/my_test/test.pb.go b/protoc-gen-go/testdata/my_test/test.pb.go
index 0e3f4c2..f9ee7fd 100644
--- a/protoc-gen-go/testdata/my_test/test.pb.go
+++ b/protoc-gen-go/testdata/my_test/test.pb.go
@@ -175,65 +175,66 @@ type Request struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *Request) Reset() { *this = Request{} }
-func (this *Request) String() string { return proto.CompactTextString(this) }
-func (*Request) ProtoMessage() {}
+func (m *Request) Reset() { *m = Request{} }
+func (m *Request) String() string { return proto.CompactTextString(m) }
+func (*Request) ProtoMessage() {}
const Default_Request_Hat HatType = HatType_FEDORA
var Default_Request_Deadline float32 = float32(math.Inf(1))
-func (this *Request) GetKey() []int64 {
- if this != nil {
- return this.Key
+func (m *Request) GetKey() []int64 {
+ if m != nil {
+ return m.Key
}
return nil
}
-func (this *Request) GetHue() Request_Color {
- if this != nil && this.Hue != nil {
- return *this.Hue
+func (m *Request) GetHue() Request_Color {
+ if m != nil && m.Hue != nil {
+ return *m.Hue
}
return 0
}
-func (this *Request) GetHat() HatType {
- if this != nil && this.Hat != nil {
- return *this.Hat
+func (m *Request) GetHat() HatType {
+ if m != nil && m.Hat != nil {
+ return *m.Hat
}
return Default_Request_Hat
}
-func (this *Request) GetDeadline() float32 {
- if this != nil && this.Deadline != nil {
- return *this.Deadline
+func (m *Request) GetDeadline() float32 {
+ if m != nil && m.Deadline != nil {
+ return *m.Deadline
}
return Default_Request_Deadline
}
-func (this *Request) GetSomegroup() *Request_SomeGroup {
- if this != nil {
- return this.Somegroup
+func (m *Request) GetSomegroup() *Request_SomeGroup {
+ if m != nil {
+ return m.Somegroup
}
return nil
}
-func (this *Request) GetReset_() int32 {
- if this != nil && this.Reset_ != nil {
- return *this.Reset_
+func (m *Request) GetReset_() int32 {
+ if m != nil && m.Reset_ != nil {
+ return *m.Reset_
}
return 0
}
type Request_SomeGroup struct {
- GroupField *int32 `protobuf:"varint,9,opt,name=group_field" json:"group_field,omitempty"`
+ GroupField *int32 `protobuf:"varint,9,opt,name=group_field" json:"group_field,omitempty"`
+ XXX_unrecognized []byte `json:"-"`
}
-func (this *Request_SomeGroup) Reset() { *this = Request_SomeGroup{} }
+func (m *Request_SomeGroup) Reset() { *m = Request_SomeGroup{} }
-func (this *Request_SomeGroup) GetGroupField() int32 {
- if this != nil && this.GroupField != nil {
- return *this.GroupField
+func (m *Request_SomeGroup) GetGroupField() int32 {
+ if m != nil && m.GroupField != nil {
+ return *m.GroupField
}
return 0
}
@@ -245,9 +246,9 @@ type Reply struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *Reply) Reset() { *this = Reply{} }
-func (this *Reply) String() string { return proto.CompactTextString(this) }
-func (*Reply) ProtoMessage() {}
+func (m *Reply) Reset() { *m = Reply{} }
+func (m *Reply) String() string { return proto.CompactTextString(m) }
+func (*Reply) ProtoMessage() {}
var extRange_Reply = []proto.ExtensionRange{
{100, 536870911},
@@ -256,23 +257,23 @@ var extRange_Reply = []proto.ExtensionRange{
func (*Reply) ExtensionRangeArray() []proto.ExtensionRange {
return extRange_Reply
}
-func (this *Reply) ExtensionMap() map[int32]proto.Extension {
- if this.XXX_extensions == nil {
- this.XXX_extensions = make(map[int32]proto.Extension)
+func (m *Reply) ExtensionMap() map[int32]proto.Extension {
+ if m.XXX_extensions == nil {
+ m.XXX_extensions = make(map[int32]proto.Extension)
}
- return this.XXX_extensions
+ return m.XXX_extensions
}
-func (this *Reply) GetFound() []*Reply_Entry {
- if this != nil {
- return this.Found
+func (m *Reply) GetFound() []*Reply_Entry {
+ if m != nil {
+ return m.Found
}
return nil
}
-func (this *Reply) GetCompactKeys() []int32 {
- if this != nil {
- return this.CompactKeys
+func (m *Reply) GetCompactKeys() []int32 {
+ if m != nil {
+ return m.CompactKeys
}
return nil
}
@@ -284,29 +285,29 @@ type Reply_Entry struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *Reply_Entry) Reset() { *this = Reply_Entry{} }
-func (this *Reply_Entry) String() string { return proto.CompactTextString(this) }
-func (*Reply_Entry) ProtoMessage() {}
+func (m *Reply_Entry) Reset() { *m = Reply_Entry{} }
+func (m *Reply_Entry) String() string { return proto.CompactTextString(m) }
+func (*Reply_Entry) ProtoMessage() {}
const Default_Reply_Entry_Value int64 = 7
-func (this *Reply_Entry) GetKeyThatNeeds_1234Camel_CasIng() int64 {
- if this != nil && this.KeyThatNeeds_1234Camel_CasIng != nil {
- return *this.KeyThatNeeds_1234Camel_CasIng
+func (m *Reply_Entry) GetKeyThatNeeds_1234Camel_CasIng() int64 {
+ if m != nil && m.KeyThatNeeds_1234Camel_CasIng != nil {
+ return *m.KeyThatNeeds_1234Camel_CasIng
}
return 0
}
-func (this *Reply_Entry) GetValue() int64 {
- if this != nil && this.Value != nil {
- return *this.Value
+func (m *Reply_Entry) GetValue() int64 {
+ if m != nil && m.Value != nil {
+ return *m.Value
}
return Default_Reply_Entry_Value
}
-func (this *Reply_Entry) GetXMyFieldName_2() int64 {
- if this != nil && this.XMyFieldName_2 != nil {
- return *this.XMyFieldName_2
+func (m *Reply_Entry) GetXMyFieldName_2() int64 {
+ if m != nil && m.XMyFieldName_2 != nil {
+ return *m.XMyFieldName_2
}
return 0
}
@@ -315,9 +316,9 @@ type ReplyExtensions struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *ReplyExtensions) Reset() { *this = ReplyExtensions{} }
-func (this *ReplyExtensions) String() string { return proto.CompactTextString(this) }
-func (*ReplyExtensions) ProtoMessage() {}
+func (m *ReplyExtensions) Reset() { *m = ReplyExtensions{} }
+func (m *ReplyExtensions) String() string { return proto.CompactTextString(m) }
+func (*ReplyExtensions) ProtoMessage() {}
var E_ReplyExtensions_Time = &proto.ExtensionDesc{
ExtendedType: (*Reply)(nil),
@@ -332,15 +333,15 @@ type OldReply struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *OldReply) Reset() { *this = OldReply{} }
-func (this *OldReply) String() string { return proto.CompactTextString(this) }
-func (*OldReply) ProtoMessage() {}
+func (m *OldReply) Reset() { *m = OldReply{} }
+func (m *OldReply) String() string { return proto.CompactTextString(m) }
+func (*OldReply) ProtoMessage() {}
-func (this *OldReply) Marshal() ([]byte, error) {
- return proto.MarshalMessageSet(this.ExtensionMap())
+func (m *OldReply) Marshal() ([]byte, error) {
+ return proto.MarshalMessageSet(m.ExtensionMap())
}
-func (this *OldReply) Unmarshal(buf []byte) error {
- return proto.UnmarshalMessageSet(buf, this.ExtensionMap())
+func (m *OldReply) Unmarshal(buf []byte) error {
+ return proto.UnmarshalMessageSet(buf, m.ExtensionMap())
}
// ensure OldReply satisfies proto.Marshaler and proto.Unmarshaler
@@ -354,11 +355,11 @@ var extRange_OldReply = []proto.ExtensionRange{
func (*OldReply) ExtensionRangeArray() []proto.ExtensionRange {
return extRange_OldReply
}
-func (this *OldReply) ExtensionMap() map[int32]proto.Extension {
- if this.XXX_extensions == nil {
- this.XXX_extensions = make(map[int32]proto.Extension)
+func (m *OldReply) ExtensionMap() map[int32]proto.Extension {
+ if m.XXX_extensions == nil {
+ m.XXX_extensions = make(map[int32]proto.Extension)
}
- return this.XXX_extensions
+ return m.XXX_extensions
}
var E_Tag = &proto.ExtensionDesc{
diff --git a/protoc-gen-go/testdata/my_test/test.pb.go.golden b/protoc-gen-go/testdata/my_test/test.pb.go.golden
index 0e3f4c2..f9ee7fd 100644
--- a/protoc-gen-go/testdata/my_test/test.pb.go.golden
+++ b/protoc-gen-go/testdata/my_test/test.pb.go.golden
@@ -175,65 +175,66 @@ type Request struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *Request) Reset() { *this = Request{} }
-func (this *Request) String() string { return proto.CompactTextString(this) }
-func (*Request) ProtoMessage() {}
+func (m *Request) Reset() { *m = Request{} }
+func (m *Request) String() string { return proto.CompactTextString(m) }
+func (*Request) ProtoMessage() {}
const Default_Request_Hat HatType = HatType_FEDORA
var Default_Request_Deadline float32 = float32(math.Inf(1))
-func (this *Request) GetKey() []int64 {
- if this != nil {
- return this.Key
+func (m *Request) GetKey() []int64 {
+ if m != nil {
+ return m.Key
}
return nil
}
-func (this *Request) GetHue() Request_Color {
- if this != nil && this.Hue != nil {
- return *this.Hue
+func (m *Request) GetHue() Request_Color {
+ if m != nil && m.Hue != nil {
+ return *m.Hue
}
return 0
}
-func (this *Request) GetHat() HatType {
- if this != nil && this.Hat != nil {
- return *this.Hat
+func (m *Request) GetHat() HatType {
+ if m != nil && m.Hat != nil {
+ return *m.Hat
}
return Default_Request_Hat
}
-func (this *Request) GetDeadline() float32 {
- if this != nil && this.Deadline != nil {
- return *this.Deadline
+func (m *Request) GetDeadline() float32 {
+ if m != nil && m.Deadline != nil {
+ return *m.Deadline
}
return Default_Request_Deadline
}
-func (this *Request) GetSomegroup() *Request_SomeGroup {
- if this != nil {
- return this.Somegroup
+func (m *Request) GetSomegroup() *Request_SomeGroup {
+ if m != nil {
+ return m.Somegroup
}
return nil
}
-func (this *Request) GetReset_() int32 {
- if this != nil && this.Reset_ != nil {
- return *this.Reset_
+func (m *Request) GetReset_() int32 {
+ if m != nil && m.Reset_ != nil {
+ return *m.Reset_
}
return 0
}
type Request_SomeGroup struct {
- GroupField *int32 `protobuf:"varint,9,opt,name=group_field" json:"group_field,omitempty"`
+ GroupField *int32 `protobuf:"varint,9,opt,name=group_field" json:"group_field,omitempty"`
+ XXX_unrecognized []byte `json:"-"`
}
-func (this *Request_SomeGroup) Reset() { *this = Request_SomeGroup{} }
+func (m *Request_SomeGroup) Reset() { *m = Request_SomeGroup{} }
-func (this *Request_SomeGroup) GetGroupField() int32 {
- if this != nil && this.GroupField != nil {
- return *this.GroupField
+func (m *Request_SomeGroup) GetGroupField() int32 {
+ if m != nil && m.GroupField != nil {
+ return *m.GroupField
}
return 0
}
@@ -245,9 +246,9 @@ type Reply struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *Reply) Reset() { *this = Reply{} }
-func (this *Reply) String() string { return proto.CompactTextString(this) }
-func (*Reply) ProtoMessage() {}
+func (m *Reply) Reset() { *m = Reply{} }
+func (m *Reply) String() string { return proto.CompactTextString(m) }
+func (*Reply) ProtoMessage() {}
var extRange_Reply = []proto.ExtensionRange{
{100, 536870911},
@@ -256,23 +257,23 @@ var extRange_Reply = []proto.ExtensionRange{
func (*Reply) ExtensionRangeArray() []proto.ExtensionRange {
return extRange_Reply
}
-func (this *Reply) ExtensionMap() map[int32]proto.Extension {
- if this.XXX_extensions == nil {
- this.XXX_extensions = make(map[int32]proto.Extension)
+func (m *Reply) ExtensionMap() map[int32]proto.Extension {
+ if m.XXX_extensions == nil {
+ m.XXX_extensions = make(map[int32]proto.Extension)
}
- return this.XXX_extensions
+ return m.XXX_extensions
}
-func (this *Reply) GetFound() []*Reply_Entry {
- if this != nil {
- return this.Found
+func (m *Reply) GetFound() []*Reply_Entry {
+ if m != nil {
+ return m.Found
}
return nil
}
-func (this *Reply) GetCompactKeys() []int32 {
- if this != nil {
- return this.CompactKeys
+func (m *Reply) GetCompactKeys() []int32 {
+ if m != nil {
+ return m.CompactKeys
}
return nil
}
@@ -284,29 +285,29 @@ type Reply_Entry struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *Reply_Entry) Reset() { *this = Reply_Entry{} }
-func (this *Reply_Entry) String() string { return proto.CompactTextString(this) }
-func (*Reply_Entry) ProtoMessage() {}
+func (m *Reply_Entry) Reset() { *m = Reply_Entry{} }
+func (m *Reply_Entry) String() string { return proto.CompactTextString(m) }
+func (*Reply_Entry) ProtoMessage() {}
const Default_Reply_Entry_Value int64 = 7
-func (this *Reply_Entry) GetKeyThatNeeds_1234Camel_CasIng() int64 {
- if this != nil && this.KeyThatNeeds_1234Camel_CasIng != nil {
- return *this.KeyThatNeeds_1234Camel_CasIng
+func (m *Reply_Entry) GetKeyThatNeeds_1234Camel_CasIng() int64 {
+ if m != nil && m.KeyThatNeeds_1234Camel_CasIng != nil {
+ return *m.KeyThatNeeds_1234Camel_CasIng
}
return 0
}
-func (this *Reply_Entry) GetValue() int64 {
- if this != nil && this.Value != nil {
- return *this.Value
+func (m *Reply_Entry) GetValue() int64 {
+ if m != nil && m.Value != nil {
+ return *m.Value
}
return Default_Reply_Entry_Value
}
-func (this *Reply_Entry) GetXMyFieldName_2() int64 {
- if this != nil && this.XMyFieldName_2 != nil {
- return *this.XMyFieldName_2
+func (m *Reply_Entry) GetXMyFieldName_2() int64 {
+ if m != nil && m.XMyFieldName_2 != nil {
+ return *m.XMyFieldName_2
}
return 0
}
@@ -315,9 +316,9 @@ type ReplyExtensions struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *ReplyExtensions) Reset() { *this = ReplyExtensions{} }
-func (this *ReplyExtensions) String() string { return proto.CompactTextString(this) }
-func (*ReplyExtensions) ProtoMessage() {}
+func (m *ReplyExtensions) Reset() { *m = ReplyExtensions{} }
+func (m *ReplyExtensions) String() string { return proto.CompactTextString(m) }
+func (*ReplyExtensions) ProtoMessage() {}
var E_ReplyExtensions_Time = &proto.ExtensionDesc{
ExtendedType: (*Reply)(nil),
@@ -332,15 +333,15 @@ type OldReply struct {
XXX_unrecognized []byte `json:"-"`
}
-func (this *OldReply) Reset() { *this = OldReply{} }
-func (this *OldReply) String() string { return proto.CompactTextString(this) }
-func (*OldReply) ProtoMessage() {}
+func (m *OldReply) Reset() { *m = OldReply{} }
+func (m *OldReply) String() string { return proto.CompactTextString(m) }
+func (*OldReply) ProtoMessage() {}
-func (this *OldReply) Marshal() ([]byte, error) {
- return proto.MarshalMessageSet(this.ExtensionMap())
+func (m *OldReply) Marshal() ([]byte, error) {
+ return proto.MarshalMessageSet(m.ExtensionMap())
}
-func (this *OldReply) Unmarshal(buf []byte) error {
- return proto.UnmarshalMessageSet(buf, this.ExtensionMap())
+func (m *OldReply) Unmarshal(buf []byte) error {
+ return proto.UnmarshalMessageSet(buf, m.ExtensionMap())
}
// ensure OldReply satisfies proto.Marshaler and proto.Unmarshaler
@@ -354,11 +355,11 @@ var extRange_OldReply = []proto.ExtensionRange{
func (*OldReply) ExtensionRangeArray() []proto.ExtensionRange {
return extRange_OldReply
}
-func (this *OldReply) ExtensionMap() map[int32]proto.Extension {
- if this.XXX_extensions == nil {
- this.XXX_extensions = make(map[int32]proto.Extension)
+func (m *OldReply) ExtensionMap() map[int32]proto.Extension {
+ if m.XXX_extensions == nil {
+ m.XXX_extensions = make(map[int32]proto.Extension)
}
- return this.XXX_extensions
+ return m.XXX_extensions
}
var E_Tag = &proto.ExtensionDesc{