cmd/protoc-gen-go: generate common message methods
Generate the standard Reset, String, ProtoMessage, and Descriptor
methods for each message struct.
Generate the table-driven support methods (XXX_Marshal, et al.).
Change-Id: I8a5ed8af1433b481e2458ad534456692d6f74c1f
Reviewed-on: https://go-review.googlesource.com/134996
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
diff --git a/cmd/protoc-gen-go/testdata/proto2/enum.pb.go b/cmd/protoc-gen-go/testdata/proto2/enum.pb.go
index 8911ecd..5a32525 100644
--- a/cmd/protoc-gen-go/testdata/proto2/enum.pb.go
+++ b/cmd/protoc-gen-go/testdata/proto2/enum.pb.go
@@ -176,6 +176,30 @@
XXX_sizecache int32 `json:"-"`
}
+func (m *EnumContainerMessage1) Reset() { *m = EnumContainerMessage1{} }
+func (m *EnumContainerMessage1) String() string { return proto.CompactTextString(m) }
+func (*EnumContainerMessage1) ProtoMessage() {}
+func (*EnumContainerMessage1) Descriptor() ([]byte, []int) {
+ return fileDescriptor_de9f68860d540858, []int{0}
+}
+func (m *EnumContainerMessage1) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_EnumContainerMessage1.Unmarshal(m, b)
+}
+func (m *EnumContainerMessage1) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_EnumContainerMessage1.Marshal(b, m, deterministic)
+}
+func (m *EnumContainerMessage1) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_EnumContainerMessage1.Merge(m, src)
+}
+func (m *EnumContainerMessage1) XXX_Size() int {
+ return xxx_messageInfo_EnumContainerMessage1.Size(m)
+}
+func (m *EnumContainerMessage1) XXX_DiscardUnknown() {
+ xxx_messageInfo_EnumContainerMessage1.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_EnumContainerMessage1 proto.InternalMessageInfo
+
// NestedEnumType2A comment.
type EnumContainerMessage1_EnumContainerMessage2_NestedEnumType2A int32
@@ -258,6 +282,34 @@
XXX_sizecache int32 `json:"-"`
}
+func (m *EnumContainerMessage1_EnumContainerMessage2) Reset() {
+ *m = EnumContainerMessage1_EnumContainerMessage2{}
+}
+func (m *EnumContainerMessage1_EnumContainerMessage2) String() string {
+ return proto.CompactTextString(m)
+}
+func (*EnumContainerMessage1_EnumContainerMessage2) ProtoMessage() {}
+func (*EnumContainerMessage1_EnumContainerMessage2) Descriptor() ([]byte, []int) {
+ return fileDescriptor_de9f68860d540858, []int{0, 0}
+}
+func (m *EnumContainerMessage1_EnumContainerMessage2) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_EnumContainerMessage1_EnumContainerMessage2.Unmarshal(m, b)
+}
+func (m *EnumContainerMessage1_EnumContainerMessage2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_EnumContainerMessage1_EnumContainerMessage2.Marshal(b, m, deterministic)
+}
+func (m *EnumContainerMessage1_EnumContainerMessage2) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_EnumContainerMessage1_EnumContainerMessage2.Merge(m, src)
+}
+func (m *EnumContainerMessage1_EnumContainerMessage2) XXX_Size() int {
+ return xxx_messageInfo_EnumContainerMessage1_EnumContainerMessage2.Size(m)
+}
+func (m *EnumContainerMessage1_EnumContainerMessage2) XXX_DiscardUnknown() {
+ xxx_messageInfo_EnumContainerMessage1_EnumContainerMessage2.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_EnumContainerMessage1_EnumContainerMessage2 proto.InternalMessageInfo
+
func init() {
proto.RegisterEnum("goproto.protoc.proto2.EnumType1", EnumType1_name, EnumType1_value)
proto.RegisterEnum("goproto.protoc.proto2.EnumType2", EnumType2_name, EnumType2_value)