github.com/gogo/protobuf@v1.3.2/test/issue8/proto.pb.go (about) 1 // Code generated by protoc-gen-gogo. DO NOT EDIT. 2 // source: proto.proto 3 4 package proto 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 ) 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 Foo struct { 28 Bar *uint64 `protobuf:"varint,1,req,name=bar" json:"bar,omitempty"` 29 XXX_NoUnkeyedLiteral struct{} `json:"-"` 30 XXX_unrecognized []byte `json:"-"` 31 XXX_sizecache int32 `json:"-"` 32 } 33 34 func (m *Foo) Reset() { *m = Foo{} } 35 func (m *Foo) String() string { return proto.CompactTextString(m) } 36 func (*Foo) ProtoMessage() {} 37 func (*Foo) Descriptor() ([]byte, []int) { 38 return fileDescriptor_2fcc84b9998d60d8, []int{0} 39 } 40 func (m *Foo) XXX_Unmarshal(b []byte) error { 41 return m.Unmarshal(b) 42 } 43 func (m *Foo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 44 return xxx_messageInfo_Foo.Marshal(b, m, deterministic) 45 } 46 func (m *Foo) XXX_Merge(src proto.Message) { 47 xxx_messageInfo_Foo.Merge(m, src) 48 } 49 func (m *Foo) XXX_Size() int { 50 return xxx_messageInfo_Foo.Size(m) 51 } 52 func (m *Foo) XXX_DiscardUnknown() { 53 xxx_messageInfo_Foo.DiscardUnknown(m) 54 } 55 56 var xxx_messageInfo_Foo proto.InternalMessageInfo 57 58 func (m *Foo) GetBar() uint64 { 59 if m != nil && m.Bar != nil { 60 return *m.Bar 61 } 62 return 0 63 } 64 65 func init() { 66 proto.RegisterType((*Foo)(nil), "proto.Foo") 67 } 68 69 func init() { proto.RegisterFile("proto.proto", fileDescriptor_2fcc84b9998d60d8) } 70 71 var fileDescriptor_2fcc84b9998d60d8 = []byte{ 72 // 109 bytes of a gzipped FileDescriptorProto 73 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2e, 0x28, 0xca, 0x2f, 74 0xc9, 0xd7, 0x03, 0x93, 0x42, 0xac, 0x60, 0x4a, 0x4a, 0x37, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 75 0x2f, 0x39, 0x3f, 0x57, 0x3f, 0x3d, 0x3f, 0x3d, 0x5f, 0x1f, 0x2c, 0x9c, 0x54, 0x9a, 0x06, 0xe6, 76 0x81, 0x39, 0x60, 0x16, 0x44, 0x97, 0x92, 0x38, 0x17, 0xb3, 0x5b, 0x7e, 0xbe, 0x90, 0x00, 0x17, 77 0x73, 0x52, 0x62, 0x91, 0x04, 0xa3, 0x02, 0x93, 0x06, 0x4b, 0x10, 0x88, 0xe9, 0x24, 0xf0, 0xe3, 78 0xa1, 0x1c, 0xe3, 0x8a, 0x47, 0x72, 0x8c, 0x3b, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0x08, 79 0x08, 0x00, 0x00, 0xff, 0xff, 0x54, 0x06, 0x1b, 0x76, 0x6e, 0x00, 0x00, 0x00, 80 } 81 82 func (this *Foo) Equal(that interface{}) bool { 83 if that == nil { 84 return this == nil 85 } 86 87 that1, ok := that.(*Foo) 88 if !ok { 89 that2, ok := that.(Foo) 90 if ok { 91 that1 = &that2 92 } else { 93 return false 94 } 95 } 96 if that1 == nil { 97 return this == nil 98 } else if this == nil { 99 return false 100 } 101 if this.Bar != nil && that1.Bar != nil { 102 if *this.Bar != *that1.Bar { 103 return false 104 } 105 } else if this.Bar != nil { 106 return false 107 } else if that1.Bar != nil { 108 return false 109 } 110 if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { 111 return false 112 } 113 return true 114 } 115 func NewPopulatedFoo(r randyProto, easy bool) *Foo { 116 this := &Foo{} 117 v1 := uint64(uint64(r.Uint32())) 118 this.Bar = &v1 119 if !easy && r.Intn(10) != 0 { 120 this.XXX_unrecognized = randUnrecognizedProto(r, 2) 121 } 122 return this 123 } 124 125 type randyProto interface { 126 Float32() float32 127 Float64() float64 128 Int63() int64 129 Int31() int32 130 Uint32() uint32 131 Intn(n int) int 132 } 133 134 func randUTF8RuneProto(r randyProto) rune { 135 ru := r.Intn(62) 136 if ru < 10 { 137 return rune(ru + 48) 138 } else if ru < 36 { 139 return rune(ru + 55) 140 } 141 return rune(ru + 61) 142 } 143 func randStringProto(r randyProto) string { 144 v2 := r.Intn(100) 145 tmps := make([]rune, v2) 146 for i := 0; i < v2; i++ { 147 tmps[i] = randUTF8RuneProto(r) 148 } 149 return string(tmps) 150 } 151 func randUnrecognizedProto(r randyProto, maxFieldNumber int) (dAtA []byte) { 152 l := r.Intn(5) 153 for i := 0; i < l; i++ { 154 wire := r.Intn(4) 155 if wire == 3 { 156 wire = 5 157 } 158 fieldNumber := maxFieldNumber + r.Intn(100) 159 dAtA = randFieldProto(dAtA, r, fieldNumber, wire) 160 } 161 return dAtA 162 } 163 func randFieldProto(dAtA []byte, r randyProto, fieldNumber int, wire int) []byte { 164 key := uint32(fieldNumber)<<3 | uint32(wire) 165 switch wire { 166 case 0: 167 dAtA = encodeVarintPopulateProto(dAtA, uint64(key)) 168 v3 := r.Int63() 169 if r.Intn(2) == 0 { 170 v3 *= -1 171 } 172 dAtA = encodeVarintPopulateProto(dAtA, uint64(v3)) 173 case 1: 174 dAtA = encodeVarintPopulateProto(dAtA, uint64(key)) 175 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))) 176 case 2: 177 dAtA = encodeVarintPopulateProto(dAtA, uint64(key)) 178 ll := r.Intn(100) 179 dAtA = encodeVarintPopulateProto(dAtA, uint64(ll)) 180 for j := 0; j < ll; j++ { 181 dAtA = append(dAtA, byte(r.Intn(256))) 182 } 183 default: 184 dAtA = encodeVarintPopulateProto(dAtA, uint64(key)) 185 dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) 186 } 187 return dAtA 188 } 189 func encodeVarintPopulateProto(dAtA []byte, v uint64) []byte { 190 for v >= 1<<7 { 191 dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) 192 v >>= 7 193 } 194 dAtA = append(dAtA, uint8(v)) 195 return dAtA 196 } 197 func (m *Foo) Unmarshal(dAtA []byte) error { 198 var hasFields [1]uint64 199 l := len(dAtA) 200 iNdEx := 0 201 for iNdEx < l { 202 preIndex := iNdEx 203 var wire uint64 204 for shift := uint(0); ; shift += 7 { 205 if shift >= 64 { 206 return ErrIntOverflowProto 207 } 208 if iNdEx >= l { 209 return io.ErrUnexpectedEOF 210 } 211 b := dAtA[iNdEx] 212 iNdEx++ 213 wire |= uint64(b&0x7F) << shift 214 if b < 0x80 { 215 break 216 } 217 } 218 fieldNum := int32(wire >> 3) 219 wireType := int(wire & 0x7) 220 if wireType == 4 { 221 return fmt.Errorf("proto: Foo: wiretype end group for non-group") 222 } 223 if fieldNum <= 0 { 224 return fmt.Errorf("proto: Foo: illegal tag %d (wire type %d)", fieldNum, wire) 225 } 226 switch fieldNum { 227 case 1: 228 if wireType != 0 { 229 return fmt.Errorf("proto: wrong wireType = %d for field Bar", wireType) 230 } 231 var v uint64 232 for shift := uint(0); ; shift += 7 { 233 if shift >= 64 { 234 return ErrIntOverflowProto 235 } 236 if iNdEx >= l { 237 return io.ErrUnexpectedEOF 238 } 239 b := dAtA[iNdEx] 240 iNdEx++ 241 v |= uint64(b&0x7F) << shift 242 if b < 0x80 { 243 break 244 } 245 } 246 m.Bar = &v 247 hasFields[0] |= uint64(0x00000001) 248 default: 249 iNdEx = preIndex 250 skippy, err := skipProto(dAtA[iNdEx:]) 251 if err != nil { 252 return err 253 } 254 if (skippy < 0) || (iNdEx+skippy) < 0 { 255 return ErrInvalidLengthProto 256 } 257 if (iNdEx + skippy) > l { 258 return io.ErrUnexpectedEOF 259 } 260 m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) 261 iNdEx += skippy 262 } 263 } 264 if hasFields[0]&uint64(0x00000001) == 0 { 265 return github_com_gogo_protobuf_proto.NewRequiredNotSetError("bar") 266 } 267 268 if iNdEx > l { 269 return io.ErrUnexpectedEOF 270 } 271 return nil 272 } 273 func skipProto(dAtA []byte) (n int, err error) { 274 l := len(dAtA) 275 iNdEx := 0 276 depth := 0 277 for iNdEx < l { 278 var wire uint64 279 for shift := uint(0); ; shift += 7 { 280 if shift >= 64 { 281 return 0, ErrIntOverflowProto 282 } 283 if iNdEx >= l { 284 return 0, io.ErrUnexpectedEOF 285 } 286 b := dAtA[iNdEx] 287 iNdEx++ 288 wire |= (uint64(b) & 0x7F) << shift 289 if b < 0x80 { 290 break 291 } 292 } 293 wireType := int(wire & 0x7) 294 switch wireType { 295 case 0: 296 for shift := uint(0); ; shift += 7 { 297 if shift >= 64 { 298 return 0, ErrIntOverflowProto 299 } 300 if iNdEx >= l { 301 return 0, io.ErrUnexpectedEOF 302 } 303 iNdEx++ 304 if dAtA[iNdEx-1] < 0x80 { 305 break 306 } 307 } 308 case 1: 309 iNdEx += 8 310 case 2: 311 var length int 312 for shift := uint(0); ; shift += 7 { 313 if shift >= 64 { 314 return 0, ErrIntOverflowProto 315 } 316 if iNdEx >= l { 317 return 0, io.ErrUnexpectedEOF 318 } 319 b := dAtA[iNdEx] 320 iNdEx++ 321 length |= (int(b) & 0x7F) << shift 322 if b < 0x80 { 323 break 324 } 325 } 326 if length < 0 { 327 return 0, ErrInvalidLengthProto 328 } 329 iNdEx += length 330 case 3: 331 depth++ 332 case 4: 333 if depth == 0 { 334 return 0, ErrUnexpectedEndOfGroupProto 335 } 336 depth-- 337 case 5: 338 iNdEx += 4 339 default: 340 return 0, fmt.Errorf("proto: illegal wireType %d", wireType) 341 } 342 if iNdEx < 0 { 343 return 0, ErrInvalidLengthProto 344 } 345 if depth == 0 { 346 return iNdEx, nil 347 } 348 } 349 return 0, io.ErrUnexpectedEOF 350 } 351 352 var ( 353 ErrInvalidLengthProto = fmt.Errorf("proto: negative length found during unmarshaling") 354 ErrIntOverflowProto = fmt.Errorf("proto: integer overflow") 355 ErrUnexpectedEndOfGroupProto = fmt.Errorf("proto: unexpected end of group") 356 )