1
2
3
4 package issue34
5
6 import (
7 fmt "fmt"
8 _ "github.com/gogo/protobuf/gogoproto"
9 proto "github.com/gogo/protobuf/proto"
10 io "io"
11 math "math"
12 )
13
14
15 var _ = proto.Marshal
16 var _ = fmt.Errorf
17 var _ = math.Inf
18
19
20
21
22
23 const _ = proto.GoGoProtoPackageIsVersion3
24
25 type Foo struct {
26 Bar []byte `protobuf:"bytes,1,opt,name=bar" json:"bar,omitempty"`
27 XXX_NoUnkeyedLiteral struct{} `json:"-"`
28 XXX_unrecognized []byte `json:"-"`
29 XXX_sizecache int32 `json:"-"`
30 }
31
32 func (m *Foo) Reset() { *m = Foo{} }
33 func (m *Foo) String() string { return proto.CompactTextString(m) }
34 func (*Foo) ProtoMessage() {}
35 func (*Foo) Descriptor() ([]byte, []int) {
36 return fileDescriptor_2fcc84b9998d60d8, []int{0}
37 }
38 func (m *Foo) XXX_Unmarshal(b []byte) error {
39 return m.Unmarshal(b)
40 }
41 func (m *Foo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
42 return xxx_messageInfo_Foo.Marshal(b, m, deterministic)
43 }
44 func (m *Foo) XXX_Merge(src proto.Message) {
45 xxx_messageInfo_Foo.Merge(m, src)
46 }
47 func (m *Foo) XXX_Size() int {
48 return xxx_messageInfo_Foo.Size(m)
49 }
50 func (m *Foo) XXX_DiscardUnknown() {
51 xxx_messageInfo_Foo.DiscardUnknown(m)
52 }
53
54 var xxx_messageInfo_Foo proto.InternalMessageInfo
55
56 func (m *Foo) GetBar() []byte {
57 if m != nil {
58 return m.Bar
59 }
60 return nil
61 }
62
63 type FooWithRepeated struct {
64 Bar [][]byte `protobuf:"bytes,1,rep,name=bar" json:"bar,omitempty"`
65 XXX_NoUnkeyedLiteral struct{} `json:"-"`
66 XXX_unrecognized []byte `json:"-"`
67 XXX_sizecache int32 `json:"-"`
68 }
69
70 func (m *FooWithRepeated) Reset() { *m = FooWithRepeated{} }
71 func (m *FooWithRepeated) String() string { return proto.CompactTextString(m) }
72 func (*FooWithRepeated) ProtoMessage() {}
73 func (*FooWithRepeated) Descriptor() ([]byte, []int) {
74 return fileDescriptor_2fcc84b9998d60d8, []int{1}
75 }
76 func (m *FooWithRepeated) XXX_Unmarshal(b []byte) error {
77 return m.Unmarshal(b)
78 }
79 func (m *FooWithRepeated) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
80 return xxx_messageInfo_FooWithRepeated.Marshal(b, m, deterministic)
81 }
82 func (m *FooWithRepeated) XXX_Merge(src proto.Message) {
83 xxx_messageInfo_FooWithRepeated.Merge(m, src)
84 }
85 func (m *FooWithRepeated) XXX_Size() int {
86 return xxx_messageInfo_FooWithRepeated.Size(m)
87 }
88 func (m *FooWithRepeated) XXX_DiscardUnknown() {
89 xxx_messageInfo_FooWithRepeated.DiscardUnknown(m)
90 }
91
92 var xxx_messageInfo_FooWithRepeated proto.InternalMessageInfo
93
94 func (m *FooWithRepeated) GetBar() [][]byte {
95 if m != nil {
96 return m.Bar
97 }
98 return nil
99 }
100
101 func init() {
102 proto.RegisterType((*Foo)(nil), "issue34.Foo")
103 proto.RegisterType((*FooWithRepeated)(nil), "issue34.FooWithRepeated")
104 }
105
106 func init() { proto.RegisterFile("proto.proto", fileDescriptor_2fcc84b9998d60d8) }
107
108 var fileDescriptor_2fcc84b9998d60d8 = []byte{
109
110 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2e, 0x28, 0xca, 0x2f,
111 0xc9, 0xd7, 0x03, 0x93, 0x42, 0xec, 0x99, 0xc5, 0xc5, 0xa5, 0xa9, 0xc6, 0x26, 0x52, 0xba, 0xe9,
112 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xe9, 0xf9, 0xe9, 0xf9, 0xfa, 0x60,
113 0xf9, 0xa4, 0xd2, 0x34, 0x30, 0x0f, 0xcc, 0x01, 0xb3, 0x20, 0xfa, 0x94, 0xc4, 0xb9, 0x98, 0xdd,
114 0xf2, 0xf3, 0x85, 0x04, 0xb8, 0x98, 0x93, 0x12, 0x8b, 0x24, 0x18, 0x15, 0x18, 0x35, 0x78, 0x82,
115 0x40, 0x4c, 0x25, 0x65, 0x2e, 0x7e, 0xb7, 0xfc, 0xfc, 0xf0, 0xcc, 0x92, 0x8c, 0xa0, 0xd4, 0x82,
116 0xd4, 0xc4, 0x92, 0xd4, 0x14, 0x84, 0x22, 0x66, 0xa8, 0x22, 0x27, 0x96, 0x0b, 0x8f, 0xe4, 0x18,
117 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x00, 0xb2, 0x1b, 0xef, 0x89, 0x00, 0x00, 0x00,
118 }
119
120 func (m *Foo) Unmarshal(dAtA []byte) error {
121 l := len(dAtA)
122 iNdEx := 0
123 for iNdEx < l {
124 preIndex := iNdEx
125 var wire uint64
126 for shift := uint(0); ; shift += 7 {
127 if shift >= 64 {
128 return ErrIntOverflowProto
129 }
130 if iNdEx >= l {
131 return io.ErrUnexpectedEOF
132 }
133 b := dAtA[iNdEx]
134 iNdEx++
135 wire |= uint64(b&0x7F) << shift
136 if b < 0x80 {
137 break
138 }
139 }
140 fieldNum := int32(wire >> 3)
141 wireType := int(wire & 0x7)
142 if wireType == 4 {
143 return fmt.Errorf("proto: Foo: wiretype end group for non-group")
144 }
145 if fieldNum <= 0 {
146 return fmt.Errorf("proto: Foo: illegal tag %d (wire type %d)", fieldNum, wire)
147 }
148 switch fieldNum {
149 case 1:
150 if wireType != 2 {
151 return fmt.Errorf("proto: wrong wireType = %d for field Bar", wireType)
152 }
153 var byteLen int
154 for shift := uint(0); ; shift += 7 {
155 if shift >= 64 {
156 return ErrIntOverflowProto
157 }
158 if iNdEx >= l {
159 return io.ErrUnexpectedEOF
160 }
161 b := dAtA[iNdEx]
162 iNdEx++
163 byteLen |= int(b&0x7F) << shift
164 if b < 0x80 {
165 break
166 }
167 }
168 if byteLen < 0 {
169 return ErrInvalidLengthProto
170 }
171 postIndex := iNdEx + byteLen
172 if postIndex < 0 {
173 return ErrInvalidLengthProto
174 }
175 if postIndex > l {
176 return io.ErrUnexpectedEOF
177 }
178 m.Bar = append(m.Bar[:0], dAtA[iNdEx:postIndex]...)
179 if m.Bar == nil {
180 m.Bar = []byte{}
181 }
182 iNdEx = postIndex
183 default:
184 iNdEx = preIndex
185 skippy, err := skipProto(dAtA[iNdEx:])
186 if err != nil {
187 return err
188 }
189 if (skippy < 0) || (iNdEx+skippy) < 0 {
190 return ErrInvalidLengthProto
191 }
192 if (iNdEx + skippy) > l {
193 return io.ErrUnexpectedEOF
194 }
195 m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
196 iNdEx += skippy
197 }
198 }
199
200 if iNdEx > l {
201 return io.ErrUnexpectedEOF
202 }
203 return nil
204 }
205 func (m *FooWithRepeated) Unmarshal(dAtA []byte) error {
206 l := len(dAtA)
207 iNdEx := 0
208 for iNdEx < l {
209 preIndex := iNdEx
210 var wire uint64
211 for shift := uint(0); ; shift += 7 {
212 if shift >= 64 {
213 return ErrIntOverflowProto
214 }
215 if iNdEx >= l {
216 return io.ErrUnexpectedEOF
217 }
218 b := dAtA[iNdEx]
219 iNdEx++
220 wire |= uint64(b&0x7F) << shift
221 if b < 0x80 {
222 break
223 }
224 }
225 fieldNum := int32(wire >> 3)
226 wireType := int(wire & 0x7)
227 if wireType == 4 {
228 return fmt.Errorf("proto: FooWithRepeated: wiretype end group for non-group")
229 }
230 if fieldNum <= 0 {
231 return fmt.Errorf("proto: FooWithRepeated: illegal tag %d (wire type %d)", fieldNum, wire)
232 }
233 switch fieldNum {
234 case 1:
235 if wireType != 2 {
236 return fmt.Errorf("proto: wrong wireType = %d for field Bar", wireType)
237 }
238 var byteLen int
239 for shift := uint(0); ; shift += 7 {
240 if shift >= 64 {
241 return ErrIntOverflowProto
242 }
243 if iNdEx >= l {
244 return io.ErrUnexpectedEOF
245 }
246 b := dAtA[iNdEx]
247 iNdEx++
248 byteLen |= int(b&0x7F) << shift
249 if b < 0x80 {
250 break
251 }
252 }
253 if byteLen < 0 {
254 return ErrInvalidLengthProto
255 }
256 postIndex := iNdEx + byteLen
257 if postIndex < 0 {
258 return ErrInvalidLengthProto
259 }
260 if postIndex > l {
261 return io.ErrUnexpectedEOF
262 }
263 m.Bar = append(m.Bar, make([]byte, postIndex-iNdEx))
264 copy(m.Bar[len(m.Bar)-1], dAtA[iNdEx:postIndex])
265 iNdEx = postIndex
266 default:
267 iNdEx = preIndex
268 skippy, err := skipProto(dAtA[iNdEx:])
269 if err != nil {
270 return err
271 }
272 if (skippy < 0) || (iNdEx+skippy) < 0 {
273 return ErrInvalidLengthProto
274 }
275 if (iNdEx + skippy) > l {
276 return io.ErrUnexpectedEOF
277 }
278 m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
279 iNdEx += skippy
280 }
281 }
282
283 if iNdEx > l {
284 return io.ErrUnexpectedEOF
285 }
286 return nil
287 }
288 func skipProto(dAtA []byte) (n int, err error) {
289 l := len(dAtA)
290 iNdEx := 0
291 depth := 0
292 for iNdEx < l {
293 var wire uint64
294 for shift := uint(0); ; shift += 7 {
295 if shift >= 64 {
296 return 0, ErrIntOverflowProto
297 }
298 if iNdEx >= l {
299 return 0, io.ErrUnexpectedEOF
300 }
301 b := dAtA[iNdEx]
302 iNdEx++
303 wire |= (uint64(b) & 0x7F) << shift
304 if b < 0x80 {
305 break
306 }
307 }
308 wireType := int(wire & 0x7)
309 switch wireType {
310 case 0:
311 for shift := uint(0); ; shift += 7 {
312 if shift >= 64 {
313 return 0, ErrIntOverflowProto
314 }
315 if iNdEx >= l {
316 return 0, io.ErrUnexpectedEOF
317 }
318 iNdEx++
319 if dAtA[iNdEx-1] < 0x80 {
320 break
321 }
322 }
323 case 1:
324 iNdEx += 8
325 case 2:
326 var length int
327 for shift := uint(0); ; shift += 7 {
328 if shift >= 64 {
329 return 0, ErrIntOverflowProto
330 }
331 if iNdEx >= l {
332 return 0, io.ErrUnexpectedEOF
333 }
334 b := dAtA[iNdEx]
335 iNdEx++
336 length |= (int(b) & 0x7F) << shift
337 if b < 0x80 {
338 break
339 }
340 }
341 if length < 0 {
342 return 0, ErrInvalidLengthProto
343 }
344 iNdEx += length
345 case 3:
346 depth++
347 case 4:
348 if depth == 0 {
349 return 0, ErrUnexpectedEndOfGroupProto
350 }
351 depth--
352 case 5:
353 iNdEx += 4
354 default:
355 return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
356 }
357 if iNdEx < 0 {
358 return 0, ErrInvalidLengthProto
359 }
360 if depth == 0 {
361 return iNdEx, nil
362 }
363 }
364 return 0, io.ErrUnexpectedEOF
365 }
366
367 var (
368 ErrInvalidLengthProto = fmt.Errorf("proto: negative length found during unmarshaling")
369 ErrIntOverflowProto = fmt.Errorf("proto: integer overflow")
370 ErrUnexpectedEndOfGroupProto = fmt.Errorf("proto: unexpected end of group")
371 )
372
View as plain text