From 0e3141f2a84d3fb3fcc6a9f7e6f9929f62062caa Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期四, 09 五月 2019 15:10:12 +0800 Subject: [PATCH] remove main.go, change test to protomsg --- protomsg.pb.go | 174 +++++++++++++++++++++++++-------------------------------- 1 files changed, 77 insertions(+), 97 deletions(-) diff --git a/test.pb.go b/protomsg.pb.go similarity index 71% rename from test.pb.go rename to protomsg.pb.go index a516fbc..f041ed8 100644 --- a/test.pb.go +++ b/protomsg.pb.go @@ -1,11 +1,11 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: test.proto +// source: protomsg.proto package protomsg import ( fmt "fmt" - proto "github.com/golang/protobuf/proto" + proto "github.com/gogo/protobuf/proto" io "io" math "math" ) @@ -19,22 +19,19 @@ // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package type TaskLabel struct { - Taskid string `protobuf:"bytes,1,opt,name=taskid,proto3" json:"taskid,omitempty"` - Sdkids []string `protobuf:"bytes,2,rep,name=sdkids,proto3" json:"sdkids,omitempty"` - Index int32 `protobuf:"varint,3,opt,name=index,proto3" json:"index,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Taskid string `protobuf:"bytes,1,opt,name=taskid,proto3" json:"taskid,omitempty"` + Sdkids []string `protobuf:"bytes,2,rep,name=sdkids,proto3" json:"sdkids,omitempty"` + Index int32 `protobuf:"varint,3,opt,name=index,proto3" json:"index,omitempty"` } func (m *TaskLabel) Reset() { *m = TaskLabel{} } func (m *TaskLabel) String() string { return proto.CompactTextString(m) } func (*TaskLabel) ProtoMessage() {} func (*TaskLabel) Descriptor() ([]byte, []int) { - return fileDescriptor_c161fcfdc0c3ff1e, []int{0} + return fileDescriptor_32de24555f916688, []int{0} } func (m *TaskLabel) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -85,19 +82,16 @@ } type SdkMessage struct { - Cid string `protobuf:"bytes,1,opt,name=cid,proto3" json:"cid,omitempty"` - Tasklab *TaskLabel `protobuf:"bytes,2,opt,name=tasklab,proto3" json:"tasklab,omitempty"` - Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Cid string `protobuf:"bytes,1,opt,name=cid,proto3" json:"cid,omitempty"` + Tasklab *TaskLabel `protobuf:"bytes,2,opt,name=tasklab,proto3" json:"tasklab,omitempty"` + Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` } func (m *SdkMessage) Reset() { *m = SdkMessage{} } func (m *SdkMessage) String() string { return proto.CompactTextString(m) } func (*SdkMessage) ProtoMessage() {} func (*SdkMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_c161fcfdc0c3ff1e, []int{1} + return fileDescriptor_32de24555f916688, []int{1} } func (m *SdkMessage) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -152,23 +146,23 @@ proto.RegisterType((*SdkMessage)(nil), "protomsg.SdkMessage") } -func init() { proto.RegisterFile("test.proto", fileDescriptor_c161fcfdc0c3ff1e) } +func init() { proto.RegisterFile("protomsg.proto", fileDescriptor_32de24555f916688) } -var fileDescriptor_c161fcfdc0c3ff1e = []byte{ - // 195 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2a, 0x49, 0x2d, 0x2e, - 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x00, 0x53, 0xb9, 0xc5, 0xe9, 0x4a, 0x81, 0x5c, - 0x9c, 0x21, 0x89, 0xc5, 0xd9, 0x3e, 0x89, 0x49, 0xa9, 0x39, 0x42, 0x62, 0x5c, 0x6c, 0x25, 0x89, - 0xc5, 0xd9, 0x99, 0x29, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0x50, 0x1e, 0x48, 0xbc, 0x38, - 0x25, 0x3b, 0x33, 0xa5, 0x58, 0x82, 0x49, 0x81, 0x19, 0x24, 0x0e, 0xe1, 0x09, 0x89, 0x70, 0xb1, - 0x66, 0xe6, 0xa5, 0xa4, 0x56, 0x48, 0x30, 0x2b, 0x30, 0x6a, 0xb0, 0x06, 0x41, 0x38, 0x4a, 0x89, - 0x5c, 0x5c, 0xc1, 0x29, 0xd9, 0xbe, 0xa9, 0xc5, 0xc5, 0x89, 0xe9, 0xa9, 0x42, 0x02, 0x5c, 0xcc, - 0xc9, 0x70, 0x03, 0x41, 0x4c, 0x21, 0x5d, 0x2e, 0x76, 0x90, 0xb9, 0x39, 0x89, 0x49, 0x12, 0x4c, - 0x0a, 0x8c, 0x1a, 0xdc, 0x46, 0xc2, 0x7a, 0x30, 0xe7, 0xe8, 0xc1, 0xdd, 0x12, 0x04, 0x53, 0x23, - 0x24, 0xc4, 0xc5, 0x92, 0x92, 0x58, 0x92, 0x08, 0xb6, 0x83, 0x27, 0x08, 0xcc, 0x76, 0x12, 0x38, - 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x67, 0x3c, 0x96, 0x63, - 0x48, 0x62, 0x03, 0x1b, 0x61, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x45, 0xc6, 0x2c, 0xfc, 0xe6, - 0x00, 0x00, 0x00, +var fileDescriptor_32de24555f916688 = []byte{ + // 201 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2b, 0x28, 0xca, 0x2f, + 0xc9, 0xcf, 0x2d, 0x4e, 0xd7, 0x03, 0x33, 0x84, 0x38, 0x60, 0x7c, 0xa5, 0x40, 0x2e, 0xce, 0x90, + 0xc4, 0xe2, 0x6c, 0x9f, 0xc4, 0xa4, 0xd4, 0x1c, 0x21, 0x31, 0x2e, 0xb6, 0x92, 0xc4, 0xe2, 0xec, + 0xcc, 0x14, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xce, 0x20, 0x28, 0x0f, 0x24, 0x5e, 0x9c, 0x92, 0x9d, + 0x99, 0x52, 0x2c, 0xc1, 0xa4, 0xc0, 0x0c, 0x12, 0x87, 0xf0, 0x84, 0x44, 0xb8, 0x58, 0x33, 0xf3, + 0x52, 0x52, 0x2b, 0x24, 0x98, 0x15, 0x18, 0x35, 0x58, 0x83, 0x20, 0x1c, 0xa5, 0x44, 0x2e, 0xae, + 0xe0, 0x94, 0x6c, 0xdf, 0xd4, 0xe2, 0xe2, 0xc4, 0xf4, 0x54, 0x21, 0x01, 0x2e, 0xe6, 0x64, 0xb8, + 0x81, 0x20, 0xa6, 0x90, 0x2e, 0x17, 0x3b, 0xc8, 0xdc, 0x9c, 0xc4, 0x24, 0x09, 0x26, 0x05, 0x46, + 0x0d, 0x6e, 0x23, 0x61, 0x3d, 0xb8, 0xf3, 0xe0, 0x6e, 0x09, 0x82, 0xa9, 0x11, 0x12, 0xe2, 0x62, + 0x49, 0x49, 0x2c, 0x49, 0x04, 0xdb, 0xc1, 0x13, 0x04, 0x66, 0x3b, 0x49, 0x9c, 0x78, 0x24, 0xc7, + 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, + 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x12, 0x1b, 0xd8, 0x28, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x69, 0xb6, 0xd7, 0x45, 0xf2, 0x00, 0x00, 0x00, } func (m *TaskLabel) Marshal() (dAtA []byte, err error) { @@ -189,7 +183,7 @@ if len(m.Taskid) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintTest(dAtA, i, uint64(len(m.Taskid))) + i = encodeVarintProtomsg(dAtA, i, uint64(len(m.Taskid))) i += copy(dAtA[i:], m.Taskid) } if len(m.Sdkids) > 0 { @@ -210,10 +204,7 @@ if m.Index != 0 { dAtA[i] = 0x18 i++ - i = encodeVarintTest(dAtA, i, uint64(m.Index)) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i = encodeVarintProtomsg(dAtA, i, uint64(m.Index)) } return i, nil } @@ -236,13 +227,13 @@ if len(m.Cid) > 0 { dAtA[i] = 0xa i++ - i = encodeVarintTest(dAtA, i, uint64(len(m.Cid))) + i = encodeVarintProtomsg(dAtA, i, uint64(len(m.Cid))) i += copy(dAtA[i:], m.Cid) } if m.Tasklab != nil { dAtA[i] = 0x12 i++ - i = encodeVarintTest(dAtA, i, uint64(m.Tasklab.Size())) + i = encodeVarintProtomsg(dAtA, i, uint64(m.Tasklab.Size())) n1, err1 := m.Tasklab.MarshalTo(dAtA[i:]) if err1 != nil { return 0, err1 @@ -252,16 +243,13 @@ if len(m.Data) > 0 { dAtA[i] = 0x1a i++ - i = encodeVarintTest(dAtA, i, uint64(len(m.Data))) + i = encodeVarintProtomsg(dAtA, i, uint64(len(m.Data))) i += copy(dAtA[i:], m.Data) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) } return i, nil } -func encodeVarintTest(dAtA []byte, offset int, v uint64) int { +func encodeVarintProtomsg(dAtA []byte, offset int, v uint64) int { for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 @@ -278,19 +266,16 @@ _ = l l = len(m.Taskid) if l > 0 { - n += 1 + l + sovTest(uint64(l)) + n += 1 + l + sovProtomsg(uint64(l)) } if len(m.Sdkids) > 0 { for _, s := range m.Sdkids { l = len(s) - n += 1 + l + sovTest(uint64(l)) + n += 1 + l + sovProtomsg(uint64(l)) } } if m.Index != 0 { - n += 1 + sovTest(uint64(m.Index)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) + n += 1 + sovProtomsg(uint64(m.Index)) } return n } @@ -303,23 +288,20 @@ _ = l l = len(m.Cid) if l > 0 { - n += 1 + l + sovTest(uint64(l)) + n += 1 + l + sovProtomsg(uint64(l)) } if m.Tasklab != nil { l = m.Tasklab.Size() - n += 1 + l + sovTest(uint64(l)) + n += 1 + l + sovProtomsg(uint64(l)) } l = len(m.Data) if l > 0 { - n += 1 + l + sovTest(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) + n += 1 + l + sovProtomsg(uint64(l)) } return n } -func sovTest(x uint64) (n int) { +func sovProtomsg(x uint64) (n int) { for { n++ x >>= 7 @@ -329,8 +311,8 @@ } return n } -func sozTest(x uint64) (n int) { - return sovTest(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +func sozProtomsg(x uint64) (n int) { + return sovProtomsg(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func (m *TaskLabel) Unmarshal(dAtA []byte) error { l := len(dAtA) @@ -340,7 +322,7 @@ var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowTest + return ErrIntOverflowProtomsg } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -368,7 +350,7 @@ var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowTest + return ErrIntOverflowProtomsg } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -382,11 +364,11 @@ } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthTest + return ErrInvalidLengthProtomsg } postIndex := iNdEx + intStringLen if postIndex < 0 { - return ErrInvalidLengthTest + return ErrInvalidLengthProtomsg } if postIndex > l { return io.ErrUnexpectedEOF @@ -400,7 +382,7 @@ var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowTest + return ErrIntOverflowProtomsg } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -414,11 +396,11 @@ } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthTest + return ErrInvalidLengthProtomsg } postIndex := iNdEx + intStringLen if postIndex < 0 { - return ErrInvalidLengthTest + return ErrInvalidLengthProtomsg } if postIndex > l { return io.ErrUnexpectedEOF @@ -432,7 +414,7 @@ m.Index = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowTest + return ErrIntOverflowProtomsg } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -446,20 +428,19 @@ } default: iNdEx = preIndex - skippy, err := skipTest(dAtA[iNdEx:]) + skippy, err := skipProtomsg(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthTest + return ErrInvalidLengthProtomsg } if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTest + return ErrInvalidLengthProtomsg } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -477,7 +458,7 @@ var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowTest + return ErrIntOverflowProtomsg } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -505,7 +486,7 @@ var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowTest + return ErrIntOverflowProtomsg } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -519,11 +500,11 @@ } intStringLen := int(stringLen) if intStringLen < 0 { - return ErrInvalidLengthTest + return ErrInvalidLengthProtomsg } postIndex := iNdEx + intStringLen if postIndex < 0 { - return ErrInvalidLengthTest + return ErrInvalidLengthProtomsg } if postIndex > l { return io.ErrUnexpectedEOF @@ -537,7 +518,7 @@ var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowTest + return ErrIntOverflowProtomsg } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -550,11 +531,11 @@ } } if msglen < 0 { - return ErrInvalidLengthTest + return ErrInvalidLengthProtomsg } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthTest + return ErrInvalidLengthProtomsg } if postIndex > l { return io.ErrUnexpectedEOF @@ -573,7 +554,7 @@ var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowTest + return ErrIntOverflowProtomsg } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -586,11 +567,11 @@ } } if byteLen < 0 { - return ErrInvalidLengthTest + return ErrInvalidLengthProtomsg } postIndex := iNdEx + byteLen if postIndex < 0 { - return ErrInvalidLengthTest + return ErrInvalidLengthProtomsg } if postIndex > l { return io.ErrUnexpectedEOF @@ -602,20 +583,19 @@ iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipTest(dAtA[iNdEx:]) + skippy, err := skipProtomsg(dAtA[iNdEx:]) if err != nil { return err } if skippy < 0 { - return ErrInvalidLengthTest + return ErrInvalidLengthProtomsg } if (iNdEx + skippy) < 0 { - return ErrInvalidLengthTest + return ErrInvalidLengthProtomsg } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } @@ -625,14 +605,14 @@ } return nil } -func skipTest(dAtA []byte) (n int, err error) { +func skipProtomsg(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowTest + return 0, ErrIntOverflowProtomsg } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -649,7 +629,7 @@ case 0: for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowTest + return 0, ErrIntOverflowProtomsg } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -667,7 +647,7 @@ var length int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowTest + return 0, ErrIntOverflowProtomsg } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -680,11 +660,11 @@ } } if length < 0 { - return 0, ErrInvalidLengthTest + return 0, ErrInvalidLengthProtomsg } iNdEx += length if iNdEx < 0 { - return 0, ErrInvalidLengthTest + return 0, ErrInvalidLengthProtomsg } return iNdEx, nil case 3: @@ -693,7 +673,7 @@ var start int = iNdEx for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowTest + return 0, ErrIntOverflowProtomsg } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -709,13 +689,13 @@ if innerWireType == 4 { break } - next, err := skipTest(dAtA[start:]) + next, err := skipProtomsg(dAtA[start:]) if err != nil { return 0, err } iNdEx = start + next if iNdEx < 0 { - return 0, ErrInvalidLengthTest + return 0, ErrInvalidLengthProtomsg } } return iNdEx, nil @@ -732,6 +712,6 @@ } var ( - ErrInvalidLengthTest = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTest = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthProtomsg = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowProtomsg = fmt.Errorf("proto: integer overflow") ) -- Gitblit v1.8.0