github.com/gogo/protobuf@v1.3.2/test/issue42order/issue42.pb.go (about) 1 // Code generated by protoc-gen-gogo. DO NOT EDIT. 2 // source: issue42.proto 3 4 package issue42 5 6 import ( 7 encoding_binary "encoding/binary" 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 UnorderedFields struct { 28 A *int64 `protobuf:"varint,10,opt,name=A" json:"A,omitempty"` 29 B *uint64 `protobuf:"fixed64,1,opt,name=B" json:"B,omitempty"` 30 XXX_NoUnkeyedLiteral struct{} `json:"-"` 31 XXX_unrecognized []byte `json:"-"` 32 XXX_sizecache int32 `json:"-"` 33 } 34 35 func (m *UnorderedFields) Reset() { *m = UnorderedFields{} } 36 func (m *UnorderedFields) String() string { return proto.CompactTextString(m) } 37 func (*UnorderedFields) ProtoMessage() {} 38 func (*UnorderedFields) Descriptor() ([]byte, []int) { 39 return fileDescriptor_fb4aafed97be2033, []int{0} 40 } 41 func (m *UnorderedFields) XXX_Unmarshal(b []byte) error { 42 return m.Unmarshal(b) 43 } 44 func (m *UnorderedFields) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 45 if deterministic { 46 return xxx_messageInfo_UnorderedFields.Marshal(b, m, deterministic) 47 } else { 48 b = b[:cap(b)] 49 n, err := m.MarshalToSizedBuffer(b) 50 if err != nil { 51 return nil, err 52 } 53 return b[:n], nil 54 } 55 } 56 func (m *UnorderedFields) XXX_Merge(src proto.Message) { 57 xxx_messageInfo_UnorderedFields.Merge(m, src) 58 } 59 func (m *UnorderedFields) XXX_Size() int { 60 return m.Size() 61 } 62 func (m *UnorderedFields) XXX_DiscardUnknown() { 63 xxx_messageInfo_UnorderedFields.DiscardUnknown(m) 64 } 65 66 var xxx_messageInfo_UnorderedFields proto.InternalMessageInfo 67 68 func (m *UnorderedFields) GetA() int64 { 69 if m != nil && m.A != nil { 70 return *m.A 71 } 72 return 0 73 } 74 75 func (m *UnorderedFields) GetB() uint64 { 76 if m != nil && m.B != nil { 77 return *m.B 78 } 79 return 0 80 } 81 82 type OrderedFields struct { 83 B *uint64 `protobuf:"fixed64,1,opt,name=B" json:"B,omitempty"` 84 A *int64 `protobuf:"varint,10,opt,name=A" json:"A,omitempty"` 85 XXX_NoUnkeyedLiteral struct{} `json:"-"` 86 XXX_unrecognized []byte `json:"-"` 87 XXX_sizecache int32 `json:"-"` 88 } 89 90 func (m *OrderedFields) Reset() { *m = OrderedFields{} } 91 func (m *OrderedFields) String() string { return proto.CompactTextString(m) } 92 func (*OrderedFields) ProtoMessage() {} 93 func (*OrderedFields) Descriptor() ([]byte, []int) { 94 return fileDescriptor_fb4aafed97be2033, []int{1} 95 } 96 func (m *OrderedFields) XXX_Unmarshal(b []byte) error { 97 return m.Unmarshal(b) 98 } 99 func (m *OrderedFields) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 100 if deterministic { 101 return xxx_messageInfo_OrderedFields.Marshal(b, m, deterministic) 102 } else { 103 b = b[:cap(b)] 104 n, err := m.MarshalToSizedBuffer(b) 105 if err != nil { 106 return nil, err 107 } 108 return b[:n], nil 109 } 110 } 111 func (m *OrderedFields) XXX_Merge(src proto.Message) { 112 xxx_messageInfo_OrderedFields.Merge(m, src) 113 } 114 func (m *OrderedFields) XXX_Size() int { 115 return m.Size() 116 } 117 func (m *OrderedFields) XXX_DiscardUnknown() { 118 xxx_messageInfo_OrderedFields.DiscardUnknown(m) 119 } 120 121 var xxx_messageInfo_OrderedFields proto.InternalMessageInfo 122 123 func (m *OrderedFields) GetB() uint64 { 124 if m != nil && m.B != nil { 125 return *m.B 126 } 127 return 0 128 } 129 130 func (m *OrderedFields) GetA() int64 { 131 if m != nil && m.A != nil { 132 return *m.A 133 } 134 return 0 135 } 136 137 func init() { 138 proto.RegisterType((*UnorderedFields)(nil), "issue42.UnorderedFields") 139 proto.RegisterType((*OrderedFields)(nil), "issue42.OrderedFields") 140 } 141 142 func init() { proto.RegisterFile("issue42.proto", fileDescriptor_fb4aafed97be2033) } 143 144 var fileDescriptor_fb4aafed97be2033 = []byte{ 145 // 148 bytes of a gzipped FileDescriptorProto 146 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xcd, 0x2c, 0x2e, 0x2e, 147 0x4d, 0x35, 0x31, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x87, 0x72, 0xa5, 0x74, 0xd3, 148 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xd3, 0xf3, 0xd3, 0xf3, 0xf5, 0xc1, 149 0xf2, 0x49, 0xa5, 0x69, 0x60, 0x1e, 0x98, 0x03, 0x66, 0x41, 0xf4, 0x29, 0xe9, 0x72, 0xf1, 0x87, 150 0xe6, 0xe5, 0x17, 0xa5, 0xa4, 0x16, 0xa5, 0xa6, 0xb8, 0x65, 0xa6, 0xe6, 0xa4, 0x14, 0x0b, 0xf1, 151 0x70, 0x31, 0x3a, 0x4a, 0x70, 0x29, 0x30, 0x6a, 0x30, 0x07, 0x31, 0x3a, 0x82, 0x78, 0x4e, 0x12, 152 0x8c, 0x0a, 0x8c, 0x1a, 0x6c, 0x41, 0x8c, 0x4e, 0x4a, 0xda, 0x5c, 0xbc, 0xfe, 0xe8, 0x8a, 0x11, 153 0xd2, 0xa8, 0x5a, 0x9d, 0x04, 0x7e, 0x3c, 0x94, 0x63, 0x3c, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 154 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x38, 0xfe, 0xba, 0xa3, 155 0xb5, 0x00, 0x00, 0x00, 156 } 157 158 func (m *UnorderedFields) Marshal() (dAtA []byte, err error) { 159 size := m.Size() 160 dAtA = make([]byte, size) 161 n, err := m.MarshalToSizedBuffer(dAtA[:size]) 162 if err != nil { 163 return nil, err 164 } 165 return dAtA[:n], nil 166 } 167 168 func (m *UnorderedFields) MarshalTo(dAtA []byte) (int, error) { 169 size := m.Size() 170 return m.MarshalToSizedBuffer(dAtA[:size]) 171 } 172 173 func (m *UnorderedFields) MarshalToSizedBuffer(dAtA []byte) (int, error) { 174 i := len(dAtA) 175 _ = i 176 var l int 177 _ = l 178 if m.XXX_unrecognized != nil { 179 i -= len(m.XXX_unrecognized) 180 copy(dAtA[i:], m.XXX_unrecognized) 181 } 182 if m.A != nil { 183 i = encodeVarintIssue42(dAtA, i, uint64(*m.A)) 184 i-- 185 dAtA[i] = 0x50 186 } 187 if m.B != nil { 188 i -= 8 189 encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(*m.B)) 190 i-- 191 dAtA[i] = 0x9 192 } 193 return len(dAtA) - i, nil 194 } 195 196 func (m *OrderedFields) Marshal() (dAtA []byte, err error) { 197 size := m.Size() 198 dAtA = make([]byte, size) 199 n, err := m.MarshalToSizedBuffer(dAtA[:size]) 200 if err != nil { 201 return nil, err 202 } 203 return dAtA[:n], nil 204 } 205 206 func (m *OrderedFields) MarshalTo(dAtA []byte) (int, error) { 207 size := m.Size() 208 return m.MarshalToSizedBuffer(dAtA[:size]) 209 } 210 211 func (m *OrderedFields) MarshalToSizedBuffer(dAtA []byte) (int, error) { 212 i := len(dAtA) 213 _ = i 214 var l int 215 _ = l 216 if m.XXX_unrecognized != nil { 217 i -= len(m.XXX_unrecognized) 218 copy(dAtA[i:], m.XXX_unrecognized) 219 } 220 if m.A != nil { 221 i = encodeVarintIssue42(dAtA, i, uint64(*m.A)) 222 i-- 223 dAtA[i] = 0x50 224 } 225 if m.B != nil { 226 i -= 8 227 encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(*m.B)) 228 i-- 229 dAtA[i] = 0x9 230 } 231 return len(dAtA) - i, nil 232 } 233 234 func encodeVarintIssue42(dAtA []byte, offset int, v uint64) int { 235 offset -= sovIssue42(v) 236 base := offset 237 for v >= 1<<7 { 238 dAtA[offset] = uint8(v&0x7f | 0x80) 239 v >>= 7 240 offset++ 241 } 242 dAtA[offset] = uint8(v) 243 return base 244 } 245 func NewPopulatedUnorderedFields(r randyIssue42, easy bool) *UnorderedFields { 246 this := &UnorderedFields{} 247 if r.Intn(5) != 0 { 248 v1 := uint64(uint64(r.Uint32())) 249 this.B = &v1 250 } 251 if r.Intn(5) != 0 { 252 v2 := int64(r.Int63()) 253 if r.Intn(2) == 0 { 254 v2 *= -1 255 } 256 this.A = &v2 257 } 258 if !easy && r.Intn(10) != 0 { 259 this.XXX_unrecognized = randUnrecognizedIssue42(r, 11) 260 } 261 return this 262 } 263 264 func NewPopulatedOrderedFields(r randyIssue42, easy bool) *OrderedFields { 265 this := &OrderedFields{} 266 if r.Intn(5) != 0 { 267 v3 := uint64(uint64(r.Uint32())) 268 this.B = &v3 269 } 270 if r.Intn(5) != 0 { 271 v4 := int64(r.Int63()) 272 if r.Intn(2) == 0 { 273 v4 *= -1 274 } 275 this.A = &v4 276 } 277 if !easy && r.Intn(10) != 0 { 278 this.XXX_unrecognized = randUnrecognizedIssue42(r, 11) 279 } 280 return this 281 } 282 283 type randyIssue42 interface { 284 Float32() float32 285 Float64() float64 286 Int63() int64 287 Int31() int32 288 Uint32() uint32 289 Intn(n int) int 290 } 291 292 func randUTF8RuneIssue42(r randyIssue42) rune { 293 ru := r.Intn(62) 294 if ru < 10 { 295 return rune(ru + 48) 296 } else if ru < 36 { 297 return rune(ru + 55) 298 } 299 return rune(ru + 61) 300 } 301 func randStringIssue42(r randyIssue42) string { 302 v5 := r.Intn(100) 303 tmps := make([]rune, v5) 304 for i := 0; i < v5; i++ { 305 tmps[i] = randUTF8RuneIssue42(r) 306 } 307 return string(tmps) 308 } 309 func randUnrecognizedIssue42(r randyIssue42, maxFieldNumber int) (dAtA []byte) { 310 l := r.Intn(5) 311 for i := 0; i < l; i++ { 312 wire := r.Intn(4) 313 if wire == 3 { 314 wire = 5 315 } 316 fieldNumber := maxFieldNumber + r.Intn(100) 317 dAtA = randFieldIssue42(dAtA, r, fieldNumber, wire) 318 } 319 return dAtA 320 } 321 func randFieldIssue42(dAtA []byte, r randyIssue42, fieldNumber int, wire int) []byte { 322 key := uint32(fieldNumber)<<3 | uint32(wire) 323 switch wire { 324 case 0: 325 dAtA = encodeVarintPopulateIssue42(dAtA, uint64(key)) 326 v6 := r.Int63() 327 if r.Intn(2) == 0 { 328 v6 *= -1 329 } 330 dAtA = encodeVarintPopulateIssue42(dAtA, uint64(v6)) 331 case 1: 332 dAtA = encodeVarintPopulateIssue42(dAtA, uint64(key)) 333 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))) 334 case 2: 335 dAtA = encodeVarintPopulateIssue42(dAtA, uint64(key)) 336 ll := r.Intn(100) 337 dAtA = encodeVarintPopulateIssue42(dAtA, uint64(ll)) 338 for j := 0; j < ll; j++ { 339 dAtA = append(dAtA, byte(r.Intn(256))) 340 } 341 default: 342 dAtA = encodeVarintPopulateIssue42(dAtA, uint64(key)) 343 dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) 344 } 345 return dAtA 346 } 347 func encodeVarintPopulateIssue42(dAtA []byte, v uint64) []byte { 348 for v >= 1<<7 { 349 dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) 350 v >>= 7 351 } 352 dAtA = append(dAtA, uint8(v)) 353 return dAtA 354 } 355 func (m *UnorderedFields) Size() (n int) { 356 if m == nil { 357 return 0 358 } 359 var l int 360 _ = l 361 if m.B != nil { 362 n += 9 363 } 364 if m.A != nil { 365 n += 1 + sovIssue42(uint64(*m.A)) 366 } 367 if m.XXX_unrecognized != nil { 368 n += len(m.XXX_unrecognized) 369 } 370 return n 371 } 372 373 func (m *OrderedFields) Size() (n int) { 374 if m == nil { 375 return 0 376 } 377 var l int 378 _ = l 379 if m.B != nil { 380 n += 9 381 } 382 if m.A != nil { 383 n += 1 + sovIssue42(uint64(*m.A)) 384 } 385 if m.XXX_unrecognized != nil { 386 n += len(m.XXX_unrecognized) 387 } 388 return n 389 } 390 391 func sovIssue42(x uint64) (n int) { 392 return (math_bits.Len64(x|1) + 6) / 7 393 } 394 func sozIssue42(x uint64) (n int) { 395 return sovIssue42(uint64((x << 1) ^ uint64((int64(x) >> 63)))) 396 } 397 func (m *UnorderedFields) Unmarshal(dAtA []byte) error { 398 l := len(dAtA) 399 iNdEx := 0 400 for iNdEx < l { 401 preIndex := iNdEx 402 var wire uint64 403 for shift := uint(0); ; shift += 7 { 404 if shift >= 64 { 405 return ErrIntOverflowIssue42 406 } 407 if iNdEx >= l { 408 return io.ErrUnexpectedEOF 409 } 410 b := dAtA[iNdEx] 411 iNdEx++ 412 wire |= uint64(b&0x7F) << shift 413 if b < 0x80 { 414 break 415 } 416 } 417 fieldNum := int32(wire >> 3) 418 wireType := int(wire & 0x7) 419 if wireType == 4 { 420 return fmt.Errorf("proto: UnorderedFields: wiretype end group for non-group") 421 } 422 if fieldNum <= 0 { 423 return fmt.Errorf("proto: UnorderedFields: illegal tag %d (wire type %d)", fieldNum, wire) 424 } 425 switch fieldNum { 426 case 1: 427 if wireType != 1 { 428 return fmt.Errorf("proto: wrong wireType = %d for field B", wireType) 429 } 430 var v uint64 431 if (iNdEx + 8) > l { 432 return io.ErrUnexpectedEOF 433 } 434 v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) 435 iNdEx += 8 436 m.B = &v 437 case 10: 438 if wireType != 0 { 439 return fmt.Errorf("proto: wrong wireType = %d for field A", wireType) 440 } 441 var v int64 442 for shift := uint(0); ; shift += 7 { 443 if shift >= 64 { 444 return ErrIntOverflowIssue42 445 } 446 if iNdEx >= l { 447 return io.ErrUnexpectedEOF 448 } 449 b := dAtA[iNdEx] 450 iNdEx++ 451 v |= int64(b&0x7F) << shift 452 if b < 0x80 { 453 break 454 } 455 } 456 m.A = &v 457 default: 458 iNdEx = preIndex 459 skippy, err := skipIssue42(dAtA[iNdEx:]) 460 if err != nil { 461 return err 462 } 463 if (skippy < 0) || (iNdEx+skippy) < 0 { 464 return ErrInvalidLengthIssue42 465 } 466 if (iNdEx + skippy) > l { 467 return io.ErrUnexpectedEOF 468 } 469 m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) 470 iNdEx += skippy 471 } 472 } 473 474 if iNdEx > l { 475 return io.ErrUnexpectedEOF 476 } 477 return nil 478 } 479 func (m *OrderedFields) Unmarshal(dAtA []byte) error { 480 l := len(dAtA) 481 iNdEx := 0 482 for iNdEx < l { 483 preIndex := iNdEx 484 var wire uint64 485 for shift := uint(0); ; shift += 7 { 486 if shift >= 64 { 487 return ErrIntOverflowIssue42 488 } 489 if iNdEx >= l { 490 return io.ErrUnexpectedEOF 491 } 492 b := dAtA[iNdEx] 493 iNdEx++ 494 wire |= uint64(b&0x7F) << shift 495 if b < 0x80 { 496 break 497 } 498 } 499 fieldNum := int32(wire >> 3) 500 wireType := int(wire & 0x7) 501 if wireType == 4 { 502 return fmt.Errorf("proto: OrderedFields: wiretype end group for non-group") 503 } 504 if fieldNum <= 0 { 505 return fmt.Errorf("proto: OrderedFields: illegal tag %d (wire type %d)", fieldNum, wire) 506 } 507 switch fieldNum { 508 case 1: 509 if wireType != 1 { 510 return fmt.Errorf("proto: wrong wireType = %d for field B", wireType) 511 } 512 var v uint64 513 if (iNdEx + 8) > l { 514 return io.ErrUnexpectedEOF 515 } 516 v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) 517 iNdEx += 8 518 m.B = &v 519 case 10: 520 if wireType != 0 { 521 return fmt.Errorf("proto: wrong wireType = %d for field A", wireType) 522 } 523 var v int64 524 for shift := uint(0); ; shift += 7 { 525 if shift >= 64 { 526 return ErrIntOverflowIssue42 527 } 528 if iNdEx >= l { 529 return io.ErrUnexpectedEOF 530 } 531 b := dAtA[iNdEx] 532 iNdEx++ 533 v |= int64(b&0x7F) << shift 534 if b < 0x80 { 535 break 536 } 537 } 538 m.A = &v 539 default: 540 iNdEx = preIndex 541 skippy, err := skipIssue42(dAtA[iNdEx:]) 542 if err != nil { 543 return err 544 } 545 if (skippy < 0) || (iNdEx+skippy) < 0 { 546 return ErrInvalidLengthIssue42 547 } 548 if (iNdEx + skippy) > l { 549 return io.ErrUnexpectedEOF 550 } 551 m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) 552 iNdEx += skippy 553 } 554 } 555 556 if iNdEx > l { 557 return io.ErrUnexpectedEOF 558 } 559 return nil 560 } 561 func skipIssue42(dAtA []byte) (n int, err error) { 562 l := len(dAtA) 563 iNdEx := 0 564 depth := 0 565 for iNdEx < l { 566 var wire uint64 567 for shift := uint(0); ; shift += 7 { 568 if shift >= 64 { 569 return 0, ErrIntOverflowIssue42 570 } 571 if iNdEx >= l { 572 return 0, io.ErrUnexpectedEOF 573 } 574 b := dAtA[iNdEx] 575 iNdEx++ 576 wire |= (uint64(b) & 0x7F) << shift 577 if b < 0x80 { 578 break 579 } 580 } 581 wireType := int(wire & 0x7) 582 switch wireType { 583 case 0: 584 for shift := uint(0); ; shift += 7 { 585 if shift >= 64 { 586 return 0, ErrIntOverflowIssue42 587 } 588 if iNdEx >= l { 589 return 0, io.ErrUnexpectedEOF 590 } 591 iNdEx++ 592 if dAtA[iNdEx-1] < 0x80 { 593 break 594 } 595 } 596 case 1: 597 iNdEx += 8 598 case 2: 599 var length int 600 for shift := uint(0); ; shift += 7 { 601 if shift >= 64 { 602 return 0, ErrIntOverflowIssue42 603 } 604 if iNdEx >= l { 605 return 0, io.ErrUnexpectedEOF 606 } 607 b := dAtA[iNdEx] 608 iNdEx++ 609 length |= (int(b) & 0x7F) << shift 610 if b < 0x80 { 611 break 612 } 613 } 614 if length < 0 { 615 return 0, ErrInvalidLengthIssue42 616 } 617 iNdEx += length 618 case 3: 619 depth++ 620 case 4: 621 if depth == 0 { 622 return 0, ErrUnexpectedEndOfGroupIssue42 623 } 624 depth-- 625 case 5: 626 iNdEx += 4 627 default: 628 return 0, fmt.Errorf("proto: illegal wireType %d", wireType) 629 } 630 if iNdEx < 0 { 631 return 0, ErrInvalidLengthIssue42 632 } 633 if depth == 0 { 634 return iNdEx, nil 635 } 636 } 637 return 0, io.ErrUnexpectedEOF 638 } 639 640 var ( 641 ErrInvalidLengthIssue42 = fmt.Errorf("proto: negative length found during unmarshaling") 642 ErrIntOverflowIssue42 = fmt.Errorf("proto: integer overflow") 643 ErrUnexpectedEndOfGroupIssue42 = fmt.Errorf("proto: unexpected end of group") 644 )