github.com/gogo/protobuf@v1.3.2/test/issue498/issue498.pb.go (about) 1 // Code generated by protoc-gen-gogo. DO NOT EDIT. 2 // source: issue498.proto 3 4 package issue449 5 6 import ( 7 bytes "bytes" 8 fmt "fmt" 9 _ "github.com/gogo/protobuf/gogoproto" 10 github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" 11 proto "github.com/gogo/protobuf/proto" 12 io "io" 13 math "math" 14 math_bits "math/bits" 15 ) 16 17 // Reference imports to suppress errors if they are not otherwise used. 18 var _ = proto.Marshal 19 var _ = fmt.Errorf 20 var _ = math.Inf 21 22 // This is a compile-time assertion to ensure that this generated file 23 // is compatible with the proto package it is being compiled against. 24 // A compilation error at this line likely means your copy of the 25 // proto package needs to be updated. 26 const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package 27 28 type Message struct { 29 Uint8 *uint8 `protobuf:"varint,1,req,name=uint8,casttype=uint8" json:"uint8,omitempty"` 30 Uint16 *uint16 `protobuf:"varint,2,req,name=uint16,casttype=uint16" json:"uint16,omitempty"` 31 Int8 *int8 `protobuf:"varint,3,req,name=int8,casttype=int8" json:"int8,omitempty"` 32 Int16 *int16 `protobuf:"varint,4,req,name=int16,casttype=int16" json:"int16,omitempty"` 33 XXX_NoUnkeyedLiteral struct{} `json:"-"` 34 XXX_unrecognized []byte `json:"-"` 35 XXX_sizecache int32 `json:"-"` 36 } 37 38 func (m *Message) Reset() { *m = Message{} } 39 func (m *Message) String() string { return proto.CompactTextString(m) } 40 func (*Message) ProtoMessage() {} 41 func (*Message) Descriptor() ([]byte, []int) { 42 return fileDescriptor_fe85d52248c43d9d, []int{0} 43 } 44 func (m *Message) XXX_Unmarshal(b []byte) error { 45 return m.Unmarshal(b) 46 } 47 func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 48 if deterministic { 49 return xxx_messageInfo_Message.Marshal(b, m, deterministic) 50 } else { 51 b = b[:cap(b)] 52 n, err := m.MarshalToSizedBuffer(b) 53 if err != nil { 54 return nil, err 55 } 56 return b[:n], nil 57 } 58 } 59 func (m *Message) XXX_Merge(src proto.Message) { 60 xxx_messageInfo_Message.Merge(m, src) 61 } 62 func (m *Message) XXX_Size() int { 63 return m.Size() 64 } 65 func (m *Message) XXX_DiscardUnknown() { 66 xxx_messageInfo_Message.DiscardUnknown(m) 67 } 68 69 var xxx_messageInfo_Message proto.InternalMessageInfo 70 71 func (m *Message) GetUint8() uint8 { 72 if m != nil && m.Uint8 != nil { 73 return *m.Uint8 74 } 75 return 0 76 } 77 78 func (m *Message) GetUint16() uint16 { 79 if m != nil && m.Uint16 != nil { 80 return *m.Uint16 81 } 82 return 0 83 } 84 85 func (m *Message) GetInt8() int8 { 86 if m != nil && m.Int8 != nil { 87 return *m.Int8 88 } 89 return 0 90 } 91 92 func (m *Message) GetInt16() int16 { 93 if m != nil && m.Int16 != nil { 94 return *m.Int16 95 } 96 return 0 97 } 98 99 func init() { 100 proto.RegisterType((*Message)(nil), "issue449.Message") 101 } 102 103 func init() { proto.RegisterFile("issue498.proto", fileDescriptor_fe85d52248c43d9d) } 104 105 var fileDescriptor_fe85d52248c43d9d = []byte{ 106 // 190 bytes of a gzipped FileDescriptorProto 107 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xcb, 0x2c, 0x2e, 0x2e, 108 0x4d, 0x35, 0xb1, 0xb4, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x80, 0xf0, 0x4d, 0x2c, 109 0xa5, 0x74, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xd3, 0xf3, 0xd3, 110 0xf3, 0xf5, 0xc1, 0x0a, 0x92, 0x4a, 0xd3, 0xc0, 0x3c, 0x30, 0x07, 0xcc, 0x82, 0x68, 0x54, 0xea, 111 0x65, 0xe4, 0x62, 0xf7, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, 0x15, 0x92, 0xe7, 0x62, 0x2d, 0xcd, 112 0xcc, 0x2b, 0xb1, 0x90, 0x60, 0x54, 0x60, 0xd2, 0xe0, 0x75, 0xe2, 0xfc, 0x75, 0x4f, 0x1e, 0x22, 113 0x10, 0x04, 0xa1, 0x84, 0x94, 0xb8, 0xd8, 0x40, 0x0c, 0x43, 0x33, 0x09, 0x26, 0xb0, 0x0a, 0xae, 114 0x5f, 0xf7, 0xe4, 0xa1, 0x22, 0x41, 0x50, 0x5a, 0x48, 0x86, 0x8b, 0x05, 0x6c, 0x06, 0x33, 0x58, 115 0x05, 0xc7, 0xaf, 0x7b, 0xf2, 0x60, 0x7e, 0x10, 0x98, 0x04, 0x59, 0x01, 0x31, 0x80, 0x05, 0x61, 116 0x05, 0x44, 0x3f, 0x84, 0x72, 0x92, 0xf8, 0xf1, 0x50, 0x8e, 0x71, 0xc5, 0x23, 0x39, 0xc6, 0x1d, 117 0x8f, 0xe4, 0x18, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0x46, 118 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x95, 0x2c, 0xad, 0xb7, 0xf3, 0x00, 0x00, 0x00, 119 } 120 121 func (this *Message) Equal(that interface{}) bool { 122 if that == nil { 123 return this == nil 124 } 125 126 that1, ok := that.(*Message) 127 if !ok { 128 that2, ok := that.(Message) 129 if ok { 130 that1 = &that2 131 } else { 132 return false 133 } 134 } 135 if that1 == nil { 136 return this == nil 137 } else if this == nil { 138 return false 139 } 140 if this.Uint8 != nil && that1.Uint8 != nil { 141 if *this.Uint8 != *that1.Uint8 { 142 return false 143 } 144 } else if this.Uint8 != nil { 145 return false 146 } else if that1.Uint8 != nil { 147 return false 148 } 149 if this.Uint16 != nil && that1.Uint16 != nil { 150 if *this.Uint16 != *that1.Uint16 { 151 return false 152 } 153 } else if this.Uint16 != nil { 154 return false 155 } else if that1.Uint16 != nil { 156 return false 157 } 158 if this.Int8 != nil && that1.Int8 != nil { 159 if *this.Int8 != *that1.Int8 { 160 return false 161 } 162 } else if this.Int8 != nil { 163 return false 164 } else if that1.Int8 != nil { 165 return false 166 } 167 if this.Int16 != nil && that1.Int16 != nil { 168 if *this.Int16 != *that1.Int16 { 169 return false 170 } 171 } else if this.Int16 != nil { 172 return false 173 } else if that1.Int16 != nil { 174 return false 175 } 176 if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { 177 return false 178 } 179 return true 180 } 181 func (m *Message) Marshal() (dAtA []byte, err error) { 182 size := m.Size() 183 dAtA = make([]byte, size) 184 n, err := m.MarshalToSizedBuffer(dAtA[:size]) 185 if err != nil { 186 return nil, err 187 } 188 return dAtA[:n], nil 189 } 190 191 func (m *Message) MarshalTo(dAtA []byte) (int, error) { 192 size := m.Size() 193 return m.MarshalToSizedBuffer(dAtA[:size]) 194 } 195 196 func (m *Message) MarshalToSizedBuffer(dAtA []byte) (int, error) { 197 i := len(dAtA) 198 _ = i 199 var l int 200 _ = l 201 if m.XXX_unrecognized != nil { 202 i -= len(m.XXX_unrecognized) 203 copy(dAtA[i:], m.XXX_unrecognized) 204 } 205 if m.Int16 == nil { 206 return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("int16") 207 } else { 208 i = encodeVarintIssue498(dAtA, i, uint64(*m.Int16)) 209 i-- 210 dAtA[i] = 0x20 211 } 212 if m.Int8 == nil { 213 return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("int8") 214 } else { 215 i = encodeVarintIssue498(dAtA, i, uint64(*m.Int8)) 216 i-- 217 dAtA[i] = 0x18 218 } 219 if m.Uint16 == nil { 220 return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("uint16") 221 } else { 222 i = encodeVarintIssue498(dAtA, i, uint64(*m.Uint16)) 223 i-- 224 dAtA[i] = 0x10 225 } 226 if m.Uint8 == nil { 227 return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("uint8") 228 } else { 229 i = encodeVarintIssue498(dAtA, i, uint64(*m.Uint8)) 230 i-- 231 dAtA[i] = 0x8 232 } 233 return len(dAtA) - i, nil 234 } 235 236 func encodeVarintIssue498(dAtA []byte, offset int, v uint64) int { 237 offset -= sovIssue498(v) 238 base := offset 239 for v >= 1<<7 { 240 dAtA[offset] = uint8(v&0x7f | 0x80) 241 v >>= 7 242 offset++ 243 } 244 dAtA[offset] = uint8(v) 245 return base 246 } 247 func NewPopulatedMessage(r randyIssue498, easy bool) *Message { 248 this := &Message{} 249 v1 := uint8(r.Uint32()) 250 this.Uint8 = &v1 251 v2 := uint16(r.Uint32()) 252 this.Uint16 = &v2 253 v3 := int8(r.Uint32()) 254 this.Int8 = &v3 255 v4 := int16(r.Uint32()) 256 this.Int16 = &v4 257 if !easy && r.Intn(10) != 0 { 258 this.XXX_unrecognized = randUnrecognizedIssue498(r, 5) 259 } 260 return this 261 } 262 263 type randyIssue498 interface { 264 Float32() float32 265 Float64() float64 266 Int63() int64 267 Int31() int32 268 Uint32() uint32 269 Intn(n int) int 270 } 271 272 func randUTF8RuneIssue498(r randyIssue498) rune { 273 ru := r.Intn(62) 274 if ru < 10 { 275 return rune(ru + 48) 276 } else if ru < 36 { 277 return rune(ru + 55) 278 } 279 return rune(ru + 61) 280 } 281 func randStringIssue498(r randyIssue498) string { 282 v5 := r.Intn(100) 283 tmps := make([]rune, v5) 284 for i := 0; i < v5; i++ { 285 tmps[i] = randUTF8RuneIssue498(r) 286 } 287 return string(tmps) 288 } 289 func randUnrecognizedIssue498(r randyIssue498, maxFieldNumber int) (dAtA []byte) { 290 l := r.Intn(5) 291 for i := 0; i < l; i++ { 292 wire := r.Intn(4) 293 if wire == 3 { 294 wire = 5 295 } 296 fieldNumber := maxFieldNumber + r.Intn(100) 297 dAtA = randFieldIssue498(dAtA, r, fieldNumber, wire) 298 } 299 return dAtA 300 } 301 func randFieldIssue498(dAtA []byte, r randyIssue498, fieldNumber int, wire int) []byte { 302 key := uint32(fieldNumber)<<3 | uint32(wire) 303 switch wire { 304 case 0: 305 dAtA = encodeVarintPopulateIssue498(dAtA, uint64(key)) 306 v6 := r.Int63() 307 if r.Intn(2) == 0 { 308 v6 *= -1 309 } 310 dAtA = encodeVarintPopulateIssue498(dAtA, uint64(v6)) 311 case 1: 312 dAtA = encodeVarintPopulateIssue498(dAtA, uint64(key)) 313 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))) 314 case 2: 315 dAtA = encodeVarintPopulateIssue498(dAtA, uint64(key)) 316 ll := r.Intn(100) 317 dAtA = encodeVarintPopulateIssue498(dAtA, uint64(ll)) 318 for j := 0; j < ll; j++ { 319 dAtA = append(dAtA, byte(r.Intn(256))) 320 } 321 default: 322 dAtA = encodeVarintPopulateIssue498(dAtA, uint64(key)) 323 dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) 324 } 325 return dAtA 326 } 327 func encodeVarintPopulateIssue498(dAtA []byte, v uint64) []byte { 328 for v >= 1<<7 { 329 dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) 330 v >>= 7 331 } 332 dAtA = append(dAtA, uint8(v)) 333 return dAtA 334 } 335 func (m *Message) Size() (n int) { 336 if m == nil { 337 return 0 338 } 339 var l int 340 _ = l 341 if m.Uint8 != nil { 342 n += 1 + sovIssue498(uint64(*m.Uint8)) 343 } 344 if m.Uint16 != nil { 345 n += 1 + sovIssue498(uint64(*m.Uint16)) 346 } 347 if m.Int8 != nil { 348 n += 1 + sovIssue498(uint64(*m.Int8)) 349 } 350 if m.Int16 != nil { 351 n += 1 + sovIssue498(uint64(*m.Int16)) 352 } 353 if m.XXX_unrecognized != nil { 354 n += len(m.XXX_unrecognized) 355 } 356 return n 357 } 358 359 func sovIssue498(x uint64) (n int) { 360 return (math_bits.Len64(x|1) + 6) / 7 361 } 362 func sozIssue498(x uint64) (n int) { 363 return sovIssue498(uint64((x << 1) ^ uint64((int64(x) >> 63)))) 364 } 365 func (m *Message) Unmarshal(dAtA []byte) error { 366 var hasFields [1]uint64 367 l := len(dAtA) 368 iNdEx := 0 369 for iNdEx < l { 370 preIndex := iNdEx 371 var wire uint64 372 for shift := uint(0); ; shift += 7 { 373 if shift >= 64 { 374 return ErrIntOverflowIssue498 375 } 376 if iNdEx >= l { 377 return io.ErrUnexpectedEOF 378 } 379 b := dAtA[iNdEx] 380 iNdEx++ 381 wire |= uint64(b&0x7F) << shift 382 if b < 0x80 { 383 break 384 } 385 } 386 fieldNum := int32(wire >> 3) 387 wireType := int(wire & 0x7) 388 if wireType == 4 { 389 return fmt.Errorf("proto: Message: wiretype end group for non-group") 390 } 391 if fieldNum <= 0 { 392 return fmt.Errorf("proto: Message: illegal tag %d (wire type %d)", fieldNum, wire) 393 } 394 switch fieldNum { 395 case 1: 396 if wireType != 0 { 397 return fmt.Errorf("proto: wrong wireType = %d for field Uint8", wireType) 398 } 399 var v uint8 400 for shift := uint(0); ; shift += 7 { 401 if shift >= 64 { 402 return ErrIntOverflowIssue498 403 } 404 if iNdEx >= l { 405 return io.ErrUnexpectedEOF 406 } 407 b := dAtA[iNdEx] 408 iNdEx++ 409 v |= uint8(b&0x7F) << shift 410 if b < 0x80 { 411 break 412 } 413 } 414 m.Uint8 = &v 415 hasFields[0] |= uint64(0x00000001) 416 case 2: 417 if wireType != 0 { 418 return fmt.Errorf("proto: wrong wireType = %d for field Uint16", wireType) 419 } 420 var v uint16 421 for shift := uint(0); ; shift += 7 { 422 if shift >= 64 { 423 return ErrIntOverflowIssue498 424 } 425 if iNdEx >= l { 426 return io.ErrUnexpectedEOF 427 } 428 b := dAtA[iNdEx] 429 iNdEx++ 430 v |= uint16(b&0x7F) << shift 431 if b < 0x80 { 432 break 433 } 434 } 435 m.Uint16 = &v 436 hasFields[0] |= uint64(0x00000002) 437 case 3: 438 if wireType != 0 { 439 return fmt.Errorf("proto: wrong wireType = %d for field Int8", wireType) 440 } 441 var v int8 442 for shift := uint(0); ; shift += 7 { 443 if shift >= 64 { 444 return ErrIntOverflowIssue498 445 } 446 if iNdEx >= l { 447 return io.ErrUnexpectedEOF 448 } 449 b := dAtA[iNdEx] 450 iNdEx++ 451 v |= int8(b&0x7F) << shift 452 if b < 0x80 { 453 break 454 } 455 } 456 m.Int8 = &v 457 hasFields[0] |= uint64(0x00000004) 458 case 4: 459 if wireType != 0 { 460 return fmt.Errorf("proto: wrong wireType = %d for field Int16", wireType) 461 } 462 var v int16 463 for shift := uint(0); ; shift += 7 { 464 if shift >= 64 { 465 return ErrIntOverflowIssue498 466 } 467 if iNdEx >= l { 468 return io.ErrUnexpectedEOF 469 } 470 b := dAtA[iNdEx] 471 iNdEx++ 472 v |= int16(b&0x7F) << shift 473 if b < 0x80 { 474 break 475 } 476 } 477 m.Int16 = &v 478 hasFields[0] |= uint64(0x00000008) 479 default: 480 iNdEx = preIndex 481 skippy, err := skipIssue498(dAtA[iNdEx:]) 482 if err != nil { 483 return err 484 } 485 if (skippy < 0) || (iNdEx+skippy) < 0 { 486 return ErrInvalidLengthIssue498 487 } 488 if (iNdEx + skippy) > l { 489 return io.ErrUnexpectedEOF 490 } 491 m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) 492 iNdEx += skippy 493 } 494 } 495 if hasFields[0]&uint64(0x00000001) == 0 { 496 return github_com_gogo_protobuf_proto.NewRequiredNotSetError("uint8") 497 } 498 if hasFields[0]&uint64(0x00000002) == 0 { 499 return github_com_gogo_protobuf_proto.NewRequiredNotSetError("uint16") 500 } 501 if hasFields[0]&uint64(0x00000004) == 0 { 502 return github_com_gogo_protobuf_proto.NewRequiredNotSetError("int8") 503 } 504 if hasFields[0]&uint64(0x00000008) == 0 { 505 return github_com_gogo_protobuf_proto.NewRequiredNotSetError("int16") 506 } 507 508 if iNdEx > l { 509 return io.ErrUnexpectedEOF 510 } 511 return nil 512 } 513 func skipIssue498(dAtA []byte) (n int, err error) { 514 l := len(dAtA) 515 iNdEx := 0 516 depth := 0 517 for iNdEx < l { 518 var wire uint64 519 for shift := uint(0); ; shift += 7 { 520 if shift >= 64 { 521 return 0, ErrIntOverflowIssue498 522 } 523 if iNdEx >= l { 524 return 0, io.ErrUnexpectedEOF 525 } 526 b := dAtA[iNdEx] 527 iNdEx++ 528 wire |= (uint64(b) & 0x7F) << shift 529 if b < 0x80 { 530 break 531 } 532 } 533 wireType := int(wire & 0x7) 534 switch wireType { 535 case 0: 536 for shift := uint(0); ; shift += 7 { 537 if shift >= 64 { 538 return 0, ErrIntOverflowIssue498 539 } 540 if iNdEx >= l { 541 return 0, io.ErrUnexpectedEOF 542 } 543 iNdEx++ 544 if dAtA[iNdEx-1] < 0x80 { 545 break 546 } 547 } 548 case 1: 549 iNdEx += 8 550 case 2: 551 var length int 552 for shift := uint(0); ; shift += 7 { 553 if shift >= 64 { 554 return 0, ErrIntOverflowIssue498 555 } 556 if iNdEx >= l { 557 return 0, io.ErrUnexpectedEOF 558 } 559 b := dAtA[iNdEx] 560 iNdEx++ 561 length |= (int(b) & 0x7F) << shift 562 if b < 0x80 { 563 break 564 } 565 } 566 if length < 0 { 567 return 0, ErrInvalidLengthIssue498 568 } 569 iNdEx += length 570 case 3: 571 depth++ 572 case 4: 573 if depth == 0 { 574 return 0, ErrUnexpectedEndOfGroupIssue498 575 } 576 depth-- 577 case 5: 578 iNdEx += 4 579 default: 580 return 0, fmt.Errorf("proto: illegal wireType %d", wireType) 581 } 582 if iNdEx < 0 { 583 return 0, ErrInvalidLengthIssue498 584 } 585 if depth == 0 { 586 return iNdEx, nil 587 } 588 } 589 return 0, io.ErrUnexpectedEOF 590 } 591 592 var ( 593 ErrInvalidLengthIssue498 = fmt.Errorf("proto: negative length found during unmarshaling") 594 ErrIntOverflowIssue498 = fmt.Errorf("proto: integer overflow") 595 ErrUnexpectedEndOfGroupIssue498 = fmt.Errorf("proto: unexpected end of group") 596 )