issue322.pb.go 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592
  1. // Code generated by protoc-gen-gogo. DO NOT EDIT.
  2. // source: issue322.proto
  3. /*
  4. Package test is a generated protocol buffer package.
  5. It is generated from these files:
  6. issue322.proto
  7. It has these top-level messages:
  8. OneofTest
  9. */
  10. package test
  11. import proto "github.com/gogo/protobuf/proto"
  12. import fmt "fmt"
  13. import math "math"
  14. import _ "github.com/gogo/protobuf/gogoproto"
  15. import bytes "bytes"
  16. import strings "strings"
  17. import reflect "reflect"
  18. import io "io"
  19. // Reference imports to suppress errors if they are not otherwise used.
  20. var _ = proto.Marshal
  21. var _ = fmt.Errorf
  22. var _ = math.Inf
  23. // This is a compile-time assertion to ensure that this generated file
  24. // is compatible with the proto package it is being compiled against.
  25. // A compilation error at this line likely means your copy of the
  26. // proto package needs to be updated.
  27. const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
  28. type OneofTest struct {
  29. // Types that are valid to be assigned to Union:
  30. // *OneofTest_I
  31. Union isOneofTest_Union `protobuf_oneof:"union"`
  32. XXX_unrecognized []byte `json:"-"`
  33. }
  34. func (m *OneofTest) Reset() { *m = OneofTest{} }
  35. func (m *OneofTest) String() string { return proto.CompactTextString(m) }
  36. func (*OneofTest) ProtoMessage() {}
  37. func (*OneofTest) Descriptor() ([]byte, []int) { return fileDescriptorIssue322, []int{0} }
  38. const Default_OneofTest_I int32 = 4
  39. type isOneofTest_Union interface {
  40. isOneofTest_Union()
  41. Equal(interface{}) bool
  42. MarshalTo([]byte) (int, error)
  43. Size() int
  44. }
  45. type OneofTest_I struct {
  46. I int32 `protobuf:"varint,1,opt,name=i,oneof,def=4"`
  47. }
  48. func (*OneofTest_I) isOneofTest_Union() {}
  49. func (m *OneofTest) GetUnion() isOneofTest_Union {
  50. if m != nil {
  51. return m.Union
  52. }
  53. return nil
  54. }
  55. func (m *OneofTest) GetI() int32 {
  56. if x, ok := m.GetUnion().(*OneofTest_I); ok {
  57. return x.I
  58. }
  59. return Default_OneofTest_I
  60. }
  61. // XXX_OneofFuncs is for the internal use of the proto package.
  62. func (*OneofTest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
  63. return _OneofTest_OneofMarshaler, _OneofTest_OneofUnmarshaler, _OneofTest_OneofSizer, []interface{}{
  64. (*OneofTest_I)(nil),
  65. }
  66. }
  67. func _OneofTest_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
  68. m := msg.(*OneofTest)
  69. // union
  70. switch x := m.Union.(type) {
  71. case *OneofTest_I:
  72. _ = b.EncodeVarint(1<<3 | proto.WireVarint)
  73. _ = b.EncodeVarint(uint64(x.I))
  74. case nil:
  75. default:
  76. return fmt.Errorf("OneofTest.Union has unexpected type %T", x)
  77. }
  78. return nil
  79. }
  80. func _OneofTest_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
  81. m := msg.(*OneofTest)
  82. switch tag {
  83. case 1: // union.i
  84. if wire != proto.WireVarint {
  85. return true, proto.ErrInternalBadWireType
  86. }
  87. x, err := b.DecodeVarint()
  88. m.Union = &OneofTest_I{int32(x)}
  89. return true, err
  90. default:
  91. return false, nil
  92. }
  93. }
  94. func _OneofTest_OneofSizer(msg proto.Message) (n int) {
  95. m := msg.(*OneofTest)
  96. // union
  97. switch x := m.Union.(type) {
  98. case *OneofTest_I:
  99. n += proto.SizeVarint(1<<3 | proto.WireVarint)
  100. n += proto.SizeVarint(uint64(x.I))
  101. case nil:
  102. default:
  103. panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
  104. }
  105. return n
  106. }
  107. func init() {
  108. proto.RegisterType((*OneofTest)(nil), "test.OneofTest")
  109. }
  110. func (this *OneofTest) Equal(that interface{}) bool {
  111. if that == nil {
  112. if this == nil {
  113. return true
  114. }
  115. return false
  116. }
  117. that1, ok := that.(*OneofTest)
  118. if !ok {
  119. that2, ok := that.(OneofTest)
  120. if ok {
  121. that1 = &that2
  122. } else {
  123. return false
  124. }
  125. }
  126. if that1 == nil {
  127. if this == nil {
  128. return true
  129. }
  130. return false
  131. } else if this == nil {
  132. return false
  133. }
  134. if that1.Union == nil {
  135. if this.Union != nil {
  136. return false
  137. }
  138. } else if this.Union == nil {
  139. return false
  140. } else if !this.Union.Equal(that1.Union) {
  141. return false
  142. }
  143. if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
  144. return false
  145. }
  146. return true
  147. }
  148. func (this *OneofTest_I) Equal(that interface{}) bool {
  149. if that == nil {
  150. if this == nil {
  151. return true
  152. }
  153. return false
  154. }
  155. that1, ok := that.(*OneofTest_I)
  156. if !ok {
  157. that2, ok := that.(OneofTest_I)
  158. if ok {
  159. that1 = &that2
  160. } else {
  161. return false
  162. }
  163. }
  164. if that1 == nil {
  165. if this == nil {
  166. return true
  167. }
  168. return false
  169. } else if this == nil {
  170. return false
  171. }
  172. if this.I != that1.I {
  173. return false
  174. }
  175. return true
  176. }
  177. func (this *OneofTest) GoString() string {
  178. if this == nil {
  179. return "nil"
  180. }
  181. s := make([]string, 0, 5)
  182. s = append(s, "&test.OneofTest{")
  183. if this.Union != nil {
  184. s = append(s, "Union: "+fmt.Sprintf("%#v", this.Union)+",\n")
  185. }
  186. if this.XXX_unrecognized != nil {
  187. s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
  188. }
  189. s = append(s, "}")
  190. return strings.Join(s, "")
  191. }
  192. func (this *OneofTest_I) GoString() string {
  193. if this == nil {
  194. return "nil"
  195. }
  196. s := strings.Join([]string{`&test.OneofTest_I{` +
  197. `I:` + fmt.Sprintf("%#v", this.I) + `}`}, ", ")
  198. return s
  199. }
  200. func valueToGoStringIssue322(v interface{}, typ string) string {
  201. rv := reflect.ValueOf(v)
  202. if rv.IsNil() {
  203. return "nil"
  204. }
  205. pv := reflect.Indirect(rv).Interface()
  206. return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
  207. }
  208. func (m *OneofTest) Marshal() (dAtA []byte, err error) {
  209. size := m.Size()
  210. dAtA = make([]byte, size)
  211. n, err := m.MarshalTo(dAtA)
  212. if err != nil {
  213. return nil, err
  214. }
  215. return dAtA[:n], nil
  216. }
  217. func (m *OneofTest) MarshalTo(dAtA []byte) (int, error) {
  218. var i int
  219. _ = i
  220. var l int
  221. _ = l
  222. if m.Union != nil {
  223. nn1, err := m.Union.MarshalTo(dAtA[i:])
  224. if err != nil {
  225. return 0, err
  226. }
  227. i += nn1
  228. }
  229. if m.XXX_unrecognized != nil {
  230. i += copy(dAtA[i:], m.XXX_unrecognized)
  231. }
  232. return i, nil
  233. }
  234. func (m *OneofTest_I) MarshalTo(dAtA []byte) (int, error) {
  235. i := 0
  236. dAtA[i] = 0x8
  237. i++
  238. i = encodeVarintIssue322(dAtA, i, uint64(m.I))
  239. return i, nil
  240. }
  241. func encodeVarintIssue322(dAtA []byte, offset int, v uint64) int {
  242. for v >= 1<<7 {
  243. dAtA[offset] = uint8(v&0x7f | 0x80)
  244. v >>= 7
  245. offset++
  246. }
  247. dAtA[offset] = uint8(v)
  248. return offset + 1
  249. }
  250. func NewPopulatedOneofTest(r randyIssue322, easy bool) *OneofTest {
  251. this := &OneofTest{}
  252. oneofNumber_Union := []int32{1}[r.Intn(1)]
  253. switch oneofNumber_Union {
  254. case 1:
  255. this.Union = NewPopulatedOneofTest_I(r, easy)
  256. }
  257. if !easy && r.Intn(10) != 0 {
  258. this.XXX_unrecognized = randUnrecognizedIssue322(r, 2)
  259. }
  260. return this
  261. }
  262. func NewPopulatedOneofTest_I(r randyIssue322, easy bool) *OneofTest_I {
  263. this := &OneofTest_I{}
  264. this.I = int32(r.Int31())
  265. if r.Intn(2) == 0 {
  266. this.I *= -1
  267. }
  268. return this
  269. }
  270. type randyIssue322 interface {
  271. Float32() float32
  272. Float64() float64
  273. Int63() int64
  274. Int31() int32
  275. Uint32() uint32
  276. Intn(n int) int
  277. }
  278. func randUTF8RuneIssue322(r randyIssue322) rune {
  279. ru := r.Intn(62)
  280. if ru < 10 {
  281. return rune(ru + 48)
  282. } else if ru < 36 {
  283. return rune(ru + 55)
  284. }
  285. return rune(ru + 61)
  286. }
  287. func randStringIssue322(r randyIssue322) string {
  288. v1 := r.Intn(100)
  289. tmps := make([]rune, v1)
  290. for i := 0; i < v1; i++ {
  291. tmps[i] = randUTF8RuneIssue322(r)
  292. }
  293. return string(tmps)
  294. }
  295. func randUnrecognizedIssue322(r randyIssue322, maxFieldNumber int) (dAtA []byte) {
  296. l := r.Intn(5)
  297. for i := 0; i < l; i++ {
  298. wire := r.Intn(4)
  299. if wire == 3 {
  300. wire = 5
  301. }
  302. fieldNumber := maxFieldNumber + r.Intn(100)
  303. dAtA = randFieldIssue322(dAtA, r, fieldNumber, wire)
  304. }
  305. return dAtA
  306. }
  307. func randFieldIssue322(dAtA []byte, r randyIssue322, fieldNumber int, wire int) []byte {
  308. key := uint32(fieldNumber)<<3 | uint32(wire)
  309. switch wire {
  310. case 0:
  311. dAtA = encodeVarintPopulateIssue322(dAtA, uint64(key))
  312. v2 := r.Int63()
  313. if r.Intn(2) == 0 {
  314. v2 *= -1
  315. }
  316. dAtA = encodeVarintPopulateIssue322(dAtA, uint64(v2))
  317. case 1:
  318. dAtA = encodeVarintPopulateIssue322(dAtA, uint64(key))
  319. 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)))
  320. case 2:
  321. dAtA = encodeVarintPopulateIssue322(dAtA, uint64(key))
  322. ll := r.Intn(100)
  323. dAtA = encodeVarintPopulateIssue322(dAtA, uint64(ll))
  324. for j := 0; j < ll; j++ {
  325. dAtA = append(dAtA, byte(r.Intn(256)))
  326. }
  327. default:
  328. dAtA = encodeVarintPopulateIssue322(dAtA, uint64(key))
  329. dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
  330. }
  331. return dAtA
  332. }
  333. func encodeVarintPopulateIssue322(dAtA []byte, v uint64) []byte {
  334. for v >= 1<<7 {
  335. dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80))
  336. v >>= 7
  337. }
  338. dAtA = append(dAtA, uint8(v))
  339. return dAtA
  340. }
  341. func (m *OneofTest) Size() (n int) {
  342. var l int
  343. _ = l
  344. if m.Union != nil {
  345. n += m.Union.Size()
  346. }
  347. if m.XXX_unrecognized != nil {
  348. n += len(m.XXX_unrecognized)
  349. }
  350. return n
  351. }
  352. func (m *OneofTest_I) Size() (n int) {
  353. var l int
  354. _ = l
  355. n += 1 + sovIssue322(uint64(m.I))
  356. return n
  357. }
  358. func sovIssue322(x uint64) (n int) {
  359. for {
  360. n++
  361. x >>= 7
  362. if x == 0 {
  363. break
  364. }
  365. }
  366. return n
  367. }
  368. func sozIssue322(x uint64) (n int) {
  369. return sovIssue322(uint64((x << 1) ^ uint64((int64(x) >> 63))))
  370. }
  371. func (m *OneofTest) Unmarshal(dAtA []byte) error {
  372. l := len(dAtA)
  373. iNdEx := 0
  374. for iNdEx < l {
  375. preIndex := iNdEx
  376. var wire uint64
  377. for shift := uint(0); ; shift += 7 {
  378. if shift >= 64 {
  379. return ErrIntOverflowIssue322
  380. }
  381. if iNdEx >= l {
  382. return io.ErrUnexpectedEOF
  383. }
  384. b := dAtA[iNdEx]
  385. iNdEx++
  386. wire |= (uint64(b) & 0x7F) << shift
  387. if b < 0x80 {
  388. break
  389. }
  390. }
  391. fieldNum := int32(wire >> 3)
  392. wireType := int(wire & 0x7)
  393. if wireType == 4 {
  394. return fmt.Errorf("proto: OneofTest: wiretype end group for non-group")
  395. }
  396. if fieldNum <= 0 {
  397. return fmt.Errorf("proto: OneofTest: illegal tag %d (wire type %d)", fieldNum, wire)
  398. }
  399. switch fieldNum {
  400. case 1:
  401. if wireType != 0 {
  402. return fmt.Errorf("proto: wrong wireType = %d for field I", wireType)
  403. }
  404. var v int32
  405. for shift := uint(0); ; shift += 7 {
  406. if shift >= 64 {
  407. return ErrIntOverflowIssue322
  408. }
  409. if iNdEx >= l {
  410. return io.ErrUnexpectedEOF
  411. }
  412. b := dAtA[iNdEx]
  413. iNdEx++
  414. v |= (int32(b) & 0x7F) << shift
  415. if b < 0x80 {
  416. break
  417. }
  418. }
  419. m.Union = &OneofTest_I{v}
  420. default:
  421. iNdEx = preIndex
  422. skippy, err := skipIssue322(dAtA[iNdEx:])
  423. if err != nil {
  424. return err
  425. }
  426. if skippy < 0 {
  427. return ErrInvalidLengthIssue322
  428. }
  429. if (iNdEx + skippy) > l {
  430. return io.ErrUnexpectedEOF
  431. }
  432. m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
  433. iNdEx += skippy
  434. }
  435. }
  436. if iNdEx > l {
  437. return io.ErrUnexpectedEOF
  438. }
  439. return nil
  440. }
  441. func skipIssue322(dAtA []byte) (n int, err error) {
  442. l := len(dAtA)
  443. iNdEx := 0
  444. for iNdEx < l {
  445. var wire uint64
  446. for shift := uint(0); ; shift += 7 {
  447. if shift >= 64 {
  448. return 0, ErrIntOverflowIssue322
  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, ErrIntOverflowIssue322
  466. }
  467. if iNdEx >= l {
  468. return 0, io.ErrUnexpectedEOF
  469. }
  470. iNdEx++
  471. if dAtA[iNdEx-1] < 0x80 {
  472. break
  473. }
  474. }
  475. return iNdEx, nil
  476. case 1:
  477. iNdEx += 8
  478. return iNdEx, nil
  479. case 2:
  480. var length int
  481. for shift := uint(0); ; shift += 7 {
  482. if shift >= 64 {
  483. return 0, ErrIntOverflowIssue322
  484. }
  485. if iNdEx >= l {
  486. return 0, io.ErrUnexpectedEOF
  487. }
  488. b := dAtA[iNdEx]
  489. iNdEx++
  490. length |= (int(b) & 0x7F) << shift
  491. if b < 0x80 {
  492. break
  493. }
  494. }
  495. iNdEx += length
  496. if length < 0 {
  497. return 0, ErrInvalidLengthIssue322
  498. }
  499. return iNdEx, nil
  500. case 3:
  501. for {
  502. var innerWire uint64
  503. var start int = iNdEx
  504. for shift := uint(0); ; shift += 7 {
  505. if shift >= 64 {
  506. return 0, ErrIntOverflowIssue322
  507. }
  508. if iNdEx >= l {
  509. return 0, io.ErrUnexpectedEOF
  510. }
  511. b := dAtA[iNdEx]
  512. iNdEx++
  513. innerWire |= (uint64(b) & 0x7F) << shift
  514. if b < 0x80 {
  515. break
  516. }
  517. }
  518. innerWireType := int(innerWire & 0x7)
  519. if innerWireType == 4 {
  520. break
  521. }
  522. next, err := skipIssue322(dAtA[start:])
  523. if err != nil {
  524. return 0, err
  525. }
  526. iNdEx = start + next
  527. }
  528. return iNdEx, nil
  529. case 4:
  530. return iNdEx, nil
  531. case 5:
  532. iNdEx += 4
  533. return iNdEx, nil
  534. default:
  535. return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
  536. }
  537. }
  538. panic("unreachable")
  539. }
  540. var (
  541. ErrInvalidLengthIssue322 = fmt.Errorf("proto: negative length found during unmarshaling")
  542. ErrIntOverflowIssue322 = fmt.Errorf("proto: integer overflow")
  543. )
  544. func init() { proto.RegisterFile("issue322.proto", fileDescriptorIssue322) }
  545. var fileDescriptorIssue322 = []byte{
  546. // 149 bytes of a gzipped FileDescriptorProto
  547. 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0xcb, 0x2c, 0x2e, 0x2e,
  548. 0x4d, 0x35, 0x36, 0x32, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x29, 0x49, 0x2d, 0x2e,
  549. 0x91, 0xd2, 0x4d, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf, 0x4f,
  550. 0xcf, 0xd7, 0x07, 0x4b, 0x26, 0x95, 0xa6, 0x81, 0x79, 0x60, 0x0e, 0x98, 0x05, 0xd1, 0xa4, 0xa4,
  551. 0xce, 0xc5, 0xe9, 0x9f, 0x97, 0x9a, 0x9f, 0x16, 0x92, 0x5a, 0x5c, 0x22, 0x24, 0xc8, 0xc5, 0x98,
  552. 0x29, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x6a, 0xc5, 0x68, 0xe2, 0xc1, 0x10, 0xc4, 0x98, 0xe9, 0xc4,
  553. 0xce, 0xc5, 0x5a, 0x9a, 0x97, 0x99, 0x9f, 0xe7, 0x24, 0xf3, 0xe1, 0xa1, 0x1c, 0xe3, 0x8f, 0x87,
  554. 0x72, 0x8c, 0x2b, 0x1e, 0xc9, 0x31, 0xee, 0x78, 0x24, 0xc7, 0x78, 0xe2, 0x91, 0x1c, 0xe3, 0x85,
  555. 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x02, 0x02, 0x00, 0x00, 0xff, 0xff, 0xe6, 0x64, 0xd7,
  556. 0x6a, 0x8c, 0x00, 0x00, 0x00,
  557. }