github.com/gogo/protobuf@v1.3.2/test/issue261/issue261.pb.go (about) 1 // Code generated by protoc-gen-gogo. DO NOT EDIT. 2 // source: issue261.proto 3 4 package issue261 5 6 import ( 7 fmt "fmt" 8 _ "github.com/gogo/protobuf/gogoproto" 9 proto "github.com/gogo/protobuf/proto" 10 github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys" 11 _ "github.com/gogo/protobuf/types" 12 github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" 13 io "io" 14 math "math" 15 math_bits "math/bits" 16 reflect "reflect" 17 strings "strings" 18 time "time" 19 ) 20 21 // Reference imports to suppress errors if they are not otherwise used. 22 var _ = proto.Marshal 23 var _ = fmt.Errorf 24 var _ = math.Inf 25 var _ = time.Kitchen 26 27 // This is a compile-time assertion to ensure that this generated file 28 // is compatible with the proto package it is being compiled against. 29 // A compilation error at this line likely means your copy of the 30 // proto package needs to be updated. 31 const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package 32 33 type MapStdTypes struct { 34 NullableDuration map[int32]*time.Duration `protobuf:"bytes,3,rep,name=nullableDuration,proto3,stdduration" json:"nullableDuration,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` 35 } 36 37 func (m *MapStdTypes) Reset() { *m = MapStdTypes{} } 38 func (*MapStdTypes) ProtoMessage() {} 39 func (*MapStdTypes) Descriptor() ([]byte, []int) { 40 return fileDescriptor_35fa31fa2023935a, []int{0} 41 } 42 func (m *MapStdTypes) XXX_Unmarshal(b []byte) error { 43 return m.Unmarshal(b) 44 } 45 func (m *MapStdTypes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 46 if deterministic { 47 return xxx_messageInfo_MapStdTypes.Marshal(b, m, deterministic) 48 } else { 49 b = b[:cap(b)] 50 n, err := m.MarshalToSizedBuffer(b) 51 if err != nil { 52 return nil, err 53 } 54 return b[:n], nil 55 } 56 } 57 func (m *MapStdTypes) XXX_Merge(src proto.Message) { 58 xxx_messageInfo_MapStdTypes.Merge(m, src) 59 } 60 func (m *MapStdTypes) XXX_Size() int { 61 return m.Size() 62 } 63 func (m *MapStdTypes) XXX_DiscardUnknown() { 64 xxx_messageInfo_MapStdTypes.DiscardUnknown(m) 65 } 66 67 var xxx_messageInfo_MapStdTypes proto.InternalMessageInfo 68 69 func (m *MapStdTypes) GetNullableDuration() map[int32]*time.Duration { 70 if m != nil { 71 return m.NullableDuration 72 } 73 return nil 74 } 75 76 func init() { 77 proto.RegisterType((*MapStdTypes)(nil), "issue261.MapStdTypes") 78 proto.RegisterMapType((map[int32]*time.Duration)(nil), "issue261.MapStdTypes.NullableDurationEntry") 79 } 80 81 func init() { proto.RegisterFile("issue261.proto", fileDescriptor_35fa31fa2023935a) } 82 83 var fileDescriptor_35fa31fa2023935a = []byte{ 84 // 275 bytes of a gzipped FileDescriptorProto 85 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xcb, 0x2c, 0x2e, 0x2e, 86 0x4d, 0x35, 0x32, 0x33, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x80, 0xf1, 0xa5, 0x74, 87 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xd3, 0xf3, 0xd3, 0xf3, 0xf5, 88 0xc1, 0x0a, 0x92, 0x4a, 0xd3, 0xc0, 0x3c, 0x30, 0x07, 0xcc, 0x82, 0x68, 0x94, 0x92, 0x4b, 0xcf, 89 0xcf, 0x4f, 0xcf, 0x49, 0x45, 0xa8, 0x4a, 0x29, 0x2d, 0x4a, 0x2c, 0xc9, 0xcc, 0xcf, 0x83, 0xc8, 90 0x2b, 0x9d, 0x61, 0xe4, 0xe2, 0xf6, 0x4d, 0x2c, 0x08, 0x2e, 0x49, 0x09, 0xa9, 0x2c, 0x48, 0x2d, 91 0x16, 0x8a, 0xe5, 0x12, 0xc8, 0x2b, 0xcd, 0xc9, 0x49, 0x4c, 0xca, 0x49, 0x75, 0x81, 0xaa, 0x94, 92 0x60, 0x56, 0x60, 0xd6, 0xe0, 0x36, 0xd2, 0xd6, 0x83, 0xbb, 0x09, 0x49, 0x83, 0x9e, 0x1f, 0x9a, 93 0x6a, 0xd7, 0xbc, 0x92, 0xa2, 0x4a, 0x27, 0x96, 0x19, 0xf7, 0xe5, 0x19, 0x83, 0x30, 0x8c, 0x92, 94 0x8a, 0xe3, 0x12, 0xc5, 0xaa, 0x41, 0x48, 0x80, 0x8b, 0x39, 0x3b, 0xb5, 0x52, 0x82, 0x51, 0x81, 95 0x51, 0x83, 0x35, 0x08, 0xc4, 0x14, 0xd2, 0xe7, 0x62, 0x2d, 0x4b, 0xcc, 0x29, 0x4d, 0x95, 0x60, 96 0x52, 0x60, 0xd4, 0xe0, 0x36, 0x92, 0xd4, 0x83, 0xf8, 0x44, 0x0f, 0xe6, 0x13, 0x3d, 0x98, 0x01, 97 0x41, 0x10, 0x75, 0x56, 0x4c, 0x16, 0x8c, 0x4e, 0x26, 0x17, 0x1e, 0xca, 0x31, 0xdc, 0x78, 0x28, 98 0xc7, 0xf0, 0xe1, 0xa1, 0x1c, 0x63, 0xc3, 0x23, 0x39, 0xc6, 0x15, 0x8f, 0xe4, 0x18, 0x4f, 0x3c, 99 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x17, 0x8f, 0xe4, 0x18, 0x3e, 100 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 101 0x92, 0xd8, 0xc0, 0x66, 0x1a, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xa0, 0x4d, 0xcb, 0xf5, 0x76, 102 0x01, 0x00, 0x00, 103 } 104 105 func (this *MapStdTypes) Equal(that interface{}) bool { 106 if that == nil { 107 return this == nil 108 } 109 110 that1, ok := that.(*MapStdTypes) 111 if !ok { 112 that2, ok := that.(MapStdTypes) 113 if ok { 114 that1 = &that2 115 } else { 116 return false 117 } 118 } 119 if that1 == nil { 120 return this == nil 121 } else if this == nil { 122 return false 123 } 124 if len(this.NullableDuration) != len(that1.NullableDuration) { 125 return false 126 } 127 for i := range this.NullableDuration { 128 if dthis, dthat := this.NullableDuration[i], that1.NullableDuration[i]; (dthis != nil && dthat != nil && *dthis != *dthat) || (dthis != nil && dthat == nil) || (dthis == nil && dthat != nil) { 129 return false 130 } 131 } 132 return true 133 } 134 func (this *MapStdTypes) GoString() string { 135 if this == nil { 136 return "nil" 137 } 138 s := make([]string, 0, 5) 139 s = append(s, "&issue261.MapStdTypes{") 140 keysForNullableDuration := make([]int32, 0, len(this.NullableDuration)) 141 for k := range this.NullableDuration { 142 keysForNullableDuration = append(keysForNullableDuration, k) 143 } 144 github_com_gogo_protobuf_sortkeys.Int32s(keysForNullableDuration) 145 mapStringForNullableDuration := "map[int32]*time.Duration{" 146 for _, k := range keysForNullableDuration { 147 mapStringForNullableDuration += fmt.Sprintf("%#v: %#v,", k, this.NullableDuration[k]) 148 } 149 mapStringForNullableDuration += "}" 150 if this.NullableDuration != nil { 151 s = append(s, "NullableDuration: "+mapStringForNullableDuration+",\n") 152 } 153 s = append(s, "}") 154 return strings.Join(s, "") 155 } 156 func valueToGoStringIssue261(v interface{}, typ string) string { 157 rv := reflect.ValueOf(v) 158 if rv.IsNil() { 159 return "nil" 160 } 161 pv := reflect.Indirect(rv).Interface() 162 return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) 163 } 164 func (m *MapStdTypes) Marshal() (dAtA []byte, err error) { 165 size := m.Size() 166 dAtA = make([]byte, size) 167 n, err := m.MarshalToSizedBuffer(dAtA[:size]) 168 if err != nil { 169 return nil, err 170 } 171 return dAtA[:n], nil 172 } 173 174 func (m *MapStdTypes) MarshalTo(dAtA []byte) (int, error) { 175 size := m.Size() 176 return m.MarshalToSizedBuffer(dAtA[:size]) 177 } 178 179 func (m *MapStdTypes) MarshalToSizedBuffer(dAtA []byte) (int, error) { 180 i := len(dAtA) 181 _ = i 182 var l int 183 _ = l 184 if len(m.NullableDuration) > 0 { 185 for k := range m.NullableDuration { 186 v := m.NullableDuration[k] 187 baseI := i 188 if v != nil { 189 n1, err1 := github_com_gogo_protobuf_types.StdDurationMarshalTo((*v), dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration((*v)):]) 190 if err1 != nil { 191 return 0, err1 192 } 193 i -= n1 194 i = encodeVarintIssue261(dAtA, i, uint64(n1)) 195 i-- 196 dAtA[i] = 0x12 197 } 198 i = encodeVarintIssue261(dAtA, i, uint64(k)) 199 i-- 200 dAtA[i] = 0x8 201 i = encodeVarintIssue261(dAtA, i, uint64(baseI-i)) 202 i-- 203 dAtA[i] = 0x1a 204 } 205 } 206 return len(dAtA) - i, nil 207 } 208 209 func encodeVarintIssue261(dAtA []byte, offset int, v uint64) int { 210 offset -= sovIssue261(v) 211 base := offset 212 for v >= 1<<7 { 213 dAtA[offset] = uint8(v&0x7f | 0x80) 214 v >>= 7 215 offset++ 216 } 217 dAtA[offset] = uint8(v) 218 return base 219 } 220 func (m *MapStdTypes) Size() (n int) { 221 if m == nil { 222 return 0 223 } 224 var l int 225 _ = l 226 if len(m.NullableDuration) > 0 { 227 for k, v := range m.NullableDuration { 228 _ = k 229 _ = v 230 l = 0 231 if v != nil { 232 l = github_com_gogo_protobuf_types.SizeOfStdDuration(*v) 233 l += 1 + sovIssue261(uint64(l)) 234 } 235 mapEntrySize := 1 + sovIssue261(uint64(k)) + l 236 n += mapEntrySize + 1 + sovIssue261(uint64(mapEntrySize)) 237 } 238 } 239 return n 240 } 241 242 func sovIssue261(x uint64) (n int) { 243 return (math_bits.Len64(x|1) + 6) / 7 244 } 245 func sozIssue261(x uint64) (n int) { 246 return sovIssue261(uint64((x << 1) ^ uint64((int64(x) >> 63)))) 247 } 248 func (this *MapStdTypes) String() string { 249 if this == nil { 250 return "nil" 251 } 252 keysForNullableDuration := make([]int32, 0, len(this.NullableDuration)) 253 for k := range this.NullableDuration { 254 keysForNullableDuration = append(keysForNullableDuration, k) 255 } 256 github_com_gogo_protobuf_sortkeys.Int32s(keysForNullableDuration) 257 mapStringForNullableDuration := "map[int32]*time.Duration{" 258 for _, k := range keysForNullableDuration { 259 mapStringForNullableDuration += fmt.Sprintf("%v: %v,", k, this.NullableDuration[k]) 260 } 261 mapStringForNullableDuration += "}" 262 s := strings.Join([]string{`&MapStdTypes{`, 263 `NullableDuration:` + mapStringForNullableDuration + `,`, 264 `}`, 265 }, "") 266 return s 267 } 268 func valueToStringIssue261(v interface{}) string { 269 rv := reflect.ValueOf(v) 270 if rv.IsNil() { 271 return "nil" 272 } 273 pv := reflect.Indirect(rv).Interface() 274 return fmt.Sprintf("*%v", pv) 275 } 276 func (m *MapStdTypes) Unmarshal(dAtA []byte) error { 277 l := len(dAtA) 278 iNdEx := 0 279 for iNdEx < l { 280 preIndex := iNdEx 281 var wire uint64 282 for shift := uint(0); ; shift += 7 { 283 if shift >= 64 { 284 return ErrIntOverflowIssue261 285 } 286 if iNdEx >= l { 287 return io.ErrUnexpectedEOF 288 } 289 b := dAtA[iNdEx] 290 iNdEx++ 291 wire |= uint64(b&0x7F) << shift 292 if b < 0x80 { 293 break 294 } 295 } 296 fieldNum := int32(wire >> 3) 297 wireType := int(wire & 0x7) 298 if wireType == 4 { 299 return fmt.Errorf("proto: MapStdTypes: wiretype end group for non-group") 300 } 301 if fieldNum <= 0 { 302 return fmt.Errorf("proto: MapStdTypes: illegal tag %d (wire type %d)", fieldNum, wire) 303 } 304 switch fieldNum { 305 case 3: 306 if wireType != 2 { 307 return fmt.Errorf("proto: wrong wireType = %d for field NullableDuration", wireType) 308 } 309 var msglen int 310 for shift := uint(0); ; shift += 7 { 311 if shift >= 64 { 312 return ErrIntOverflowIssue261 313 } 314 if iNdEx >= l { 315 return io.ErrUnexpectedEOF 316 } 317 b := dAtA[iNdEx] 318 iNdEx++ 319 msglen |= int(b&0x7F) << shift 320 if b < 0x80 { 321 break 322 } 323 } 324 if msglen < 0 { 325 return ErrInvalidLengthIssue261 326 } 327 postIndex := iNdEx + msglen 328 if postIndex < 0 { 329 return ErrInvalidLengthIssue261 330 } 331 if postIndex > l { 332 return io.ErrUnexpectedEOF 333 } 334 if m.NullableDuration == nil { 335 m.NullableDuration = make(map[int32]*time.Duration) 336 } 337 var mapkey int32 338 mapvalue := new(time.Duration) 339 for iNdEx < postIndex { 340 entryPreIndex := iNdEx 341 var wire uint64 342 for shift := uint(0); ; shift += 7 { 343 if shift >= 64 { 344 return ErrIntOverflowIssue261 345 } 346 if iNdEx >= l { 347 return io.ErrUnexpectedEOF 348 } 349 b := dAtA[iNdEx] 350 iNdEx++ 351 wire |= uint64(b&0x7F) << shift 352 if b < 0x80 { 353 break 354 } 355 } 356 fieldNum := int32(wire >> 3) 357 if fieldNum == 1 { 358 for shift := uint(0); ; shift += 7 { 359 if shift >= 64 { 360 return ErrIntOverflowIssue261 361 } 362 if iNdEx >= l { 363 return io.ErrUnexpectedEOF 364 } 365 b := dAtA[iNdEx] 366 iNdEx++ 367 mapkey |= int32(b&0x7F) << shift 368 if b < 0x80 { 369 break 370 } 371 } 372 } else if fieldNum == 2 { 373 var mapmsglen int 374 for shift := uint(0); ; shift += 7 { 375 if shift >= 64 { 376 return ErrIntOverflowIssue261 377 } 378 if iNdEx >= l { 379 return io.ErrUnexpectedEOF 380 } 381 b := dAtA[iNdEx] 382 iNdEx++ 383 mapmsglen |= int(b&0x7F) << shift 384 if b < 0x80 { 385 break 386 } 387 } 388 if mapmsglen < 0 { 389 return ErrInvalidLengthIssue261 390 } 391 postmsgIndex := iNdEx + mapmsglen 392 if postmsgIndex < 0 { 393 return ErrInvalidLengthIssue261 394 } 395 if postmsgIndex > l { 396 return io.ErrUnexpectedEOF 397 } 398 if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(mapvalue, dAtA[iNdEx:postmsgIndex]); err != nil { 399 return err 400 } 401 iNdEx = postmsgIndex 402 } else { 403 iNdEx = entryPreIndex 404 skippy, err := skipIssue261(dAtA[iNdEx:]) 405 if err != nil { 406 return err 407 } 408 if (skippy < 0) || (iNdEx+skippy) < 0 { 409 return ErrInvalidLengthIssue261 410 } 411 if (iNdEx + skippy) > postIndex { 412 return io.ErrUnexpectedEOF 413 } 414 iNdEx += skippy 415 } 416 } 417 m.NullableDuration[mapkey] = mapvalue 418 iNdEx = postIndex 419 default: 420 iNdEx = preIndex 421 skippy, err := skipIssue261(dAtA[iNdEx:]) 422 if err != nil { 423 return err 424 } 425 if (skippy < 0) || (iNdEx+skippy) < 0 { 426 return ErrInvalidLengthIssue261 427 } 428 if (iNdEx + skippy) > l { 429 return io.ErrUnexpectedEOF 430 } 431 iNdEx += skippy 432 } 433 } 434 435 if iNdEx > l { 436 return io.ErrUnexpectedEOF 437 } 438 return nil 439 } 440 func skipIssue261(dAtA []byte) (n int, err error) { 441 l := len(dAtA) 442 iNdEx := 0 443 depth := 0 444 for iNdEx < l { 445 var wire uint64 446 for shift := uint(0); ; shift += 7 { 447 if shift >= 64 { 448 return 0, ErrIntOverflowIssue261 449 } 450 if iNdEx >= l { 451 return 0, io.ErrUnexpectedEOF 452 } 453 b := dAtA[iNdEx] 454 iNdEx++ 455 wire |= (uint64(b) & 0x7F) << shift 456 if b < 0x80 { 457 break 458 } 459 } 460 wireType := int(wire & 0x7) 461 switch wireType { 462 case 0: 463 for shift := uint(0); ; shift += 7 { 464 if shift >= 64 { 465 return 0, ErrIntOverflowIssue261 466 } 467 if iNdEx >= l { 468 return 0, io.ErrUnexpectedEOF 469 } 470 iNdEx++ 471 if dAtA[iNdEx-1] < 0x80 { 472 break 473 } 474 } 475 case 1: 476 iNdEx += 8 477 case 2: 478 var length int 479 for shift := uint(0); ; shift += 7 { 480 if shift >= 64 { 481 return 0, ErrIntOverflowIssue261 482 } 483 if iNdEx >= l { 484 return 0, io.ErrUnexpectedEOF 485 } 486 b := dAtA[iNdEx] 487 iNdEx++ 488 length |= (int(b) & 0x7F) << shift 489 if b < 0x80 { 490 break 491 } 492 } 493 if length < 0 { 494 return 0, ErrInvalidLengthIssue261 495 } 496 iNdEx += length 497 case 3: 498 depth++ 499 case 4: 500 if depth == 0 { 501 return 0, ErrUnexpectedEndOfGroupIssue261 502 } 503 depth-- 504 case 5: 505 iNdEx += 4 506 default: 507 return 0, fmt.Errorf("proto: illegal wireType %d", wireType) 508 } 509 if iNdEx < 0 { 510 return 0, ErrInvalidLengthIssue261 511 } 512 if depth == 0 { 513 return iNdEx, nil 514 } 515 } 516 return 0, io.ErrUnexpectedEOF 517 } 518 519 var ( 520 ErrInvalidLengthIssue261 = fmt.Errorf("proto: negative length found during unmarshaling") 521 ErrIntOverflowIssue261 = fmt.Errorf("proto: integer overflow") 522 ErrUnexpectedEndOfGroupIssue261 = fmt.Errorf("proto: unexpected end of group") 523 )