github.com/gogo/protobuf@v1.3.2/test/issue330/issue330.pb.go (about) 1 // Code generated by protoc-gen-gogo. DO NOT EDIT. 2 // source: issue330.proto 3 4 package issue330 5 6 import ( 7 bytes "bytes" 8 fmt "fmt" 9 _ "github.com/gogo/protobuf/gogoproto" 10 proto "github.com/gogo/protobuf/proto" 11 io "io" 12 math "math" 13 math_bits "math/bits" 14 ) 15 16 // Reference imports to suppress errors if they are not otherwise used. 17 var _ = proto.Marshal 18 var _ = fmt.Errorf 19 var _ = math.Inf 20 21 // This is a compile-time assertion to ensure that this generated file 22 // is compatible with the proto package it is being compiled against. 23 // A compilation error at this line likely means your copy of the 24 // proto package needs to be updated. 25 const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package 26 27 type Object struct { 28 Type TypeIdentifier `protobuf:"varint,1,opt,name=type,proto3,casttype=TypeIdentifier" json:"type,omitempty"` 29 XXX_NoUnkeyedLiteral struct{} `json:"-"` 30 XXX_unrecognized []byte `json:"-"` 31 XXX_sizecache int32 `json:"-"` 32 } 33 34 func (m *Object) Reset() { *m = Object{} } 35 func (m *Object) String() string { return proto.CompactTextString(m) } 36 func (*Object) ProtoMessage() {} 37 func (*Object) Descriptor() ([]byte, []int) { 38 return fileDescriptor_30faa33a004e0218, []int{0} 39 } 40 func (m *Object) XXX_Unmarshal(b []byte) error { 41 return m.Unmarshal(b) 42 } 43 func (m *Object) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 44 if deterministic { 45 return xxx_messageInfo_Object.Marshal(b, m, deterministic) 46 } else { 47 b = b[:cap(b)] 48 n, err := m.MarshalToSizedBuffer(b) 49 if err != nil { 50 return nil, err 51 } 52 return b[:n], nil 53 } 54 } 55 func (m *Object) XXX_Merge(src proto.Message) { 56 xxx_messageInfo_Object.Merge(m, src) 57 } 58 func (m *Object) XXX_Size() int { 59 return m.Size() 60 } 61 func (m *Object) XXX_DiscardUnknown() { 62 xxx_messageInfo_Object.DiscardUnknown(m) 63 } 64 65 var xxx_messageInfo_Object proto.InternalMessageInfo 66 67 func (m *Object) GetType() TypeIdentifier { 68 if m != nil { 69 return m.Type 70 } 71 return 0 72 } 73 74 func init() { 75 proto.RegisterType((*Object)(nil), "issue330.Object") 76 } 77 78 func init() { proto.RegisterFile("issue330.proto", fileDescriptor_30faa33a004e0218) } 79 80 var fileDescriptor_30faa33a004e0218 = []byte{ 81 // 158 bytes of a gzipped FileDescriptorProto 82 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xcb, 0x2c, 0x2e, 0x2e, 83 0x4d, 0x35, 0x36, 0x36, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x80, 0xf1, 0xa5, 0x74, 84 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xd3, 0xf3, 0xd3, 0xf3, 0xf5, 85 0xc1, 0x0a, 0x92, 0x4a, 0xd3, 0xc0, 0x3c, 0x30, 0x07, 0xcc, 0x82, 0x68, 0x54, 0x32, 0xe0, 0x62, 86 0xf3, 0x4f, 0xca, 0x4a, 0x4d, 0x2e, 0x11, 0x52, 0xe3, 0x62, 0x29, 0xa9, 0x2c, 0x48, 0x95, 0x60, 87 0x54, 0x60, 0xd4, 0xe0, 0x75, 0x12, 0xfa, 0x75, 0x4f, 0x9e, 0x2f, 0xa4, 0xb2, 0x20, 0xd5, 0x33, 88 0x25, 0x35, 0xaf, 0x24, 0x33, 0x2d, 0x33, 0xb5, 0x28, 0x08, 0x2c, 0xef, 0x24, 0xf3, 0xe3, 0xa1, 89 0x1c, 0xe3, 0x8a, 0x47, 0x72, 0x8c, 0x3b, 0x1e, 0xc9, 0x31, 0x1e, 0x78, 0x24, 0xc7, 0x78, 0xe2, 90 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x26, 0xb1, 0x81, 0x8d, 0x35, 91 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x8f, 0x41, 0xc2, 0x37, 0xa1, 0x00, 0x00, 0x00, 92 } 93 94 func (this *Object) Equal(that interface{}) bool { 95 if that == nil { 96 return this == nil 97 } 98 99 that1, ok := that.(*Object) 100 if !ok { 101 that2, ok := that.(Object) 102 if ok { 103 that1 = &that2 104 } else { 105 return false 106 } 107 } 108 if that1 == nil { 109 return this == nil 110 } else if this == nil { 111 return false 112 } 113 if this.Type != that1.Type { 114 return false 115 } 116 if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { 117 return false 118 } 119 return true 120 } 121 func (m *Object) Marshal() (dAtA []byte, err error) { 122 size := m.Size() 123 dAtA = make([]byte, size) 124 n, err := m.MarshalToSizedBuffer(dAtA[:size]) 125 if err != nil { 126 return nil, err 127 } 128 return dAtA[:n], nil 129 } 130 131 func (m *Object) MarshalTo(dAtA []byte) (int, error) { 132 size := m.Size() 133 return m.MarshalToSizedBuffer(dAtA[:size]) 134 } 135 136 func (m *Object) MarshalToSizedBuffer(dAtA []byte) (int, error) { 137 i := len(dAtA) 138 _ = i 139 var l int 140 _ = l 141 if m.XXX_unrecognized != nil { 142 i -= len(m.XXX_unrecognized) 143 copy(dAtA[i:], m.XXX_unrecognized) 144 } 145 if m.Type != 0 { 146 i = encodeVarintIssue330(dAtA, i, uint64(m.Type)) 147 i-- 148 dAtA[i] = 0x8 149 } 150 return len(dAtA) - i, nil 151 } 152 153 func encodeVarintIssue330(dAtA []byte, offset int, v uint64) int { 154 offset -= sovIssue330(v) 155 base := offset 156 for v >= 1<<7 { 157 dAtA[offset] = uint8(v&0x7f | 0x80) 158 v >>= 7 159 offset++ 160 } 161 dAtA[offset] = uint8(v) 162 return base 163 } 164 func NewPopulatedObject(r randyIssue330, easy bool) *Object { 165 this := &Object{} 166 this.Type = TypeIdentifier(r.Uint32()) 167 if !easy && r.Intn(10) != 0 { 168 this.XXX_unrecognized = randUnrecognizedIssue330(r, 2) 169 } 170 return this 171 } 172 173 type randyIssue330 interface { 174 Float32() float32 175 Float64() float64 176 Int63() int64 177 Int31() int32 178 Uint32() uint32 179 Intn(n int) int 180 } 181 182 func randUTF8RuneIssue330(r randyIssue330) rune { 183 ru := r.Intn(62) 184 if ru < 10 { 185 return rune(ru + 48) 186 } else if ru < 36 { 187 return rune(ru + 55) 188 } 189 return rune(ru + 61) 190 } 191 func randStringIssue330(r randyIssue330) string { 192 v1 := r.Intn(100) 193 tmps := make([]rune, v1) 194 for i := 0; i < v1; i++ { 195 tmps[i] = randUTF8RuneIssue330(r) 196 } 197 return string(tmps) 198 } 199 func randUnrecognizedIssue330(r randyIssue330, maxFieldNumber int) (dAtA []byte) { 200 l := r.Intn(5) 201 for i := 0; i < l; i++ { 202 wire := r.Intn(4) 203 if wire == 3 { 204 wire = 5 205 } 206 fieldNumber := maxFieldNumber + r.Intn(100) 207 dAtA = randFieldIssue330(dAtA, r, fieldNumber, wire) 208 } 209 return dAtA 210 } 211 func randFieldIssue330(dAtA []byte, r randyIssue330, fieldNumber int, wire int) []byte { 212 key := uint32(fieldNumber)<<3 | uint32(wire) 213 switch wire { 214 case 0: 215 dAtA = encodeVarintPopulateIssue330(dAtA, uint64(key)) 216 v2 := r.Int63() 217 if r.Intn(2) == 0 { 218 v2 *= -1 219 } 220 dAtA = encodeVarintPopulateIssue330(dAtA, uint64(v2)) 221 case 1: 222 dAtA = encodeVarintPopulateIssue330(dAtA, uint64(key)) 223 dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) 224 case 2: 225 dAtA = encodeVarintPopulateIssue330(dAtA, uint64(key)) 226 ll := r.Intn(100) 227 dAtA = encodeVarintPopulateIssue330(dAtA, uint64(ll)) 228 for j := 0; j < ll; j++ { 229 dAtA = append(dAtA, byte(r.Intn(256))) 230 } 231 default: 232 dAtA = encodeVarintPopulateIssue330(dAtA, uint64(key)) 233 dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) 234 } 235 return dAtA 236 } 237 func encodeVarintPopulateIssue330(dAtA []byte, v uint64) []byte { 238 for v >= 1<<7 { 239 dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) 240 v >>= 7 241 } 242 dAtA = append(dAtA, uint8(v)) 243 return dAtA 244 } 245 func (m *Object) Size() (n int) { 246 if m == nil { 247 return 0 248 } 249 var l int 250 _ = l 251 if m.Type != 0 { 252 n += 1 + sovIssue330(uint64(m.Type)) 253 } 254 if m.XXX_unrecognized != nil { 255 n += len(m.XXX_unrecognized) 256 } 257 return n 258 } 259 260 func sovIssue330(x uint64) (n int) { 261 return (math_bits.Len64(x|1) + 6) / 7 262 } 263 func sozIssue330(x uint64) (n int) { 264 return sovIssue330(uint64((x << 1) ^ uint64((int64(x) >> 63)))) 265 } 266 func (m *Object) Unmarshal(dAtA []byte) error { 267 l := len(dAtA) 268 iNdEx := 0 269 for iNdEx < l { 270 preIndex := iNdEx 271 var wire uint64 272 for shift := uint(0); ; shift += 7 { 273 if shift >= 64 { 274 return ErrIntOverflowIssue330 275 } 276 if iNdEx >= l { 277 return io.ErrUnexpectedEOF 278 } 279 b := dAtA[iNdEx] 280 iNdEx++ 281 wire |= uint64(b&0x7F) << shift 282 if b < 0x80 { 283 break 284 } 285 } 286 fieldNum := int32(wire >> 3) 287 wireType := int(wire & 0x7) 288 if wireType == 4 { 289 return fmt.Errorf("proto: Object: wiretype end group for non-group") 290 } 291 if fieldNum <= 0 { 292 return fmt.Errorf("proto: Object: illegal tag %d (wire type %d)", fieldNum, wire) 293 } 294 switch fieldNum { 295 case 1: 296 if wireType != 0 { 297 return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) 298 } 299 m.Type = 0 300 for shift := uint(0); ; shift += 7 { 301 if shift >= 64 { 302 return ErrIntOverflowIssue330 303 } 304 if iNdEx >= l { 305 return io.ErrUnexpectedEOF 306 } 307 b := dAtA[iNdEx] 308 iNdEx++ 309 m.Type |= TypeIdentifier(b&0x7F) << shift 310 if b < 0x80 { 311 break 312 } 313 } 314 default: 315 iNdEx = preIndex 316 skippy, err := skipIssue330(dAtA[iNdEx:]) 317 if err != nil { 318 return err 319 } 320 if (skippy < 0) || (iNdEx+skippy) < 0 { 321 return ErrInvalidLengthIssue330 322 } 323 if (iNdEx + skippy) > l { 324 return io.ErrUnexpectedEOF 325 } 326 m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) 327 iNdEx += skippy 328 } 329 } 330 331 if iNdEx > l { 332 return io.ErrUnexpectedEOF 333 } 334 return nil 335 } 336 func skipIssue330(dAtA []byte) (n int, err error) { 337 l := len(dAtA) 338 iNdEx := 0 339 depth := 0 340 for iNdEx < l { 341 var wire uint64 342 for shift := uint(0); ; shift += 7 { 343 if shift >= 64 { 344 return 0, ErrIntOverflowIssue330 345 } 346 if iNdEx >= l { 347 return 0, io.ErrUnexpectedEOF 348 } 349 b := dAtA[iNdEx] 350 iNdEx++ 351 wire |= (uint64(b) & 0x7F) << shift 352 if b < 0x80 { 353 break 354 } 355 } 356 wireType := int(wire & 0x7) 357 switch wireType { 358 case 0: 359 for shift := uint(0); ; shift += 7 { 360 if shift >= 64 { 361 return 0, ErrIntOverflowIssue330 362 } 363 if iNdEx >= l { 364 return 0, io.ErrUnexpectedEOF 365 } 366 iNdEx++ 367 if dAtA[iNdEx-1] < 0x80 { 368 break 369 } 370 } 371 case 1: 372 iNdEx += 8 373 case 2: 374 var length int 375 for shift := uint(0); ; shift += 7 { 376 if shift >= 64 { 377 return 0, ErrIntOverflowIssue330 378 } 379 if iNdEx >= l { 380 return 0, io.ErrUnexpectedEOF 381 } 382 b := dAtA[iNdEx] 383 iNdEx++ 384 length |= (int(b) & 0x7F) << shift 385 if b < 0x80 { 386 break 387 } 388 } 389 if length < 0 { 390 return 0, ErrInvalidLengthIssue330 391 } 392 iNdEx += length 393 case 3: 394 depth++ 395 case 4: 396 if depth == 0 { 397 return 0, ErrUnexpectedEndOfGroupIssue330 398 } 399 depth-- 400 case 5: 401 iNdEx += 4 402 default: 403 return 0, fmt.Errorf("proto: illegal wireType %d", wireType) 404 } 405 if iNdEx < 0 { 406 return 0, ErrInvalidLengthIssue330 407 } 408 if depth == 0 { 409 return iNdEx, nil 410 } 411 } 412 return 0, io.ErrUnexpectedEOF 413 } 414 415 var ( 416 ErrInvalidLengthIssue330 = fmt.Errorf("proto: negative length found during unmarshaling") 417 ErrIntOverflowIssue330 = fmt.Errorf("proto: integer overflow") 418 ErrUnexpectedEndOfGroupIssue330 = fmt.Errorf("proto: unexpected end of group") 419 )