// Code generated by protoc-gen-gogo. // source: proto.proto // DO NOT EDIT! /* Package proto is a generated protocol buffer package. It is generated from these files: proto.proto It has these top-level messages: Foo */ package proto import proto1 "QmfH4HuZyN1p2wQLWWkXC91Z76435xKrBVfLQ2MY8ayG5R/gogo-protobuf/proto" import fmt "fmt" import math "math" // discarding unused import gogoproto "github.com/gogo/protobuf/gogoproto" import bytes "bytes" import io "io" import github_com_gogo_protobuf_proto "QmfH4HuZyN1p2wQLWWkXC91Z76435xKrBVfLQ2MY8ayG5R/gogo-protobuf/proto" // Reference imports to suppress errors if they are not otherwise used. var _ = proto1.Marshal var _ = fmt.Errorf var _ = math.Inf type Foo struct { Bar *uint64 `protobuf:"varint,1,req,name=bar" json:"bar,omitempty"` XXX_unrecognized []byte `json:"-"` } func (m *Foo) Reset() { *m = Foo{} } func (m *Foo) String() string { return proto1.CompactTextString(m) } func (*Foo) ProtoMessage() {} func (m *Foo) GetBar() uint64 { if m != nil && m.Bar != nil { return *m.Bar } return 0 } func (this *Foo) Equal(that interface{}) bool { if that == nil { if this == nil { return true } return false } that1, ok := that.(*Foo) if !ok { return false } if that1 == nil { if this == nil { return true } return false } else if this == nil { return false } if this.Bar != nil && that1.Bar != nil { if *this.Bar != *that1.Bar { return false } } else if this.Bar != nil { return false } else if that1.Bar != nil { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } return true } func NewPopulatedFoo(r randyProto, easy bool) *Foo { this := &Foo{} v1 := uint64(uint64(r.Uint32())) this.Bar = &v1 if !easy && r.Intn(10) != 0 { this.XXX_unrecognized = randUnrecognizedProto(r, 2) } return this } type randyProto interface { Float32() float32 Float64() float64 Int63() int64 Int31() int32 Uint32() uint32 Intn(n int) int } func randUTF8RuneProto(r randyProto) rune { ru := r.Intn(62) if ru < 10 { return rune(ru + 48) } else if ru < 36 { return rune(ru + 55) } return rune(ru + 61) } func randStringProto(r randyProto) string { v2 := r.Intn(100) tmps := make([]rune, v2) for i := 0; i < v2; i++ { tmps[i] = randUTF8RuneProto(r) } return string(tmps) } func randUnrecognizedProto(r randyProto, maxFieldNumber int) (data []byte) { l := r.Intn(5) for i := 0; i < l; i++ { wire := r.Intn(4) if wire == 3 { wire = 5 } fieldNumber := maxFieldNumber + r.Intn(100) data = randFieldProto(data, r, fieldNumber, wire) } return data } func randFieldProto(data []byte, r randyProto, fieldNumber int, wire int) []byte { key := uint32(fieldNumber)<<3 | uint32(wire) switch wire { case 0: data = encodeVarintPopulateProto(data, uint64(key)) v3 := r.Int63() if r.Intn(2) == 0 { v3 *= -1 } data = encodeVarintPopulateProto(data, uint64(v3)) case 1: data = encodeVarintPopulateProto(data, uint64(key)) 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))) case 2: data = encodeVarintPopulateProto(data, uint64(key)) ll := r.Intn(100) data = encodeVarintPopulateProto(data, uint64(ll)) for j := 0; j < ll; j++ { data = append(data, byte(r.Intn(256))) } default: data = encodeVarintPopulateProto(data, uint64(key)) data = append(data, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) } return data } func encodeVarintPopulateProto(data []byte, v uint64) []byte { for v >= 1<<7 { data = append(data, uint8(uint64(v)&0x7f|0x80)) v >>= 7 } data = append(data, uint8(v)) return data } func (m *Foo) Unmarshal(data []byte) error { var hasFields [1]uint64 l := len(data) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowProto } if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: Foo: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: Foo: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Bar", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowProto } if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } m.Bar = &v hasFields[0] |= uint64(0x00000001) default: iNdEx = preIndex skippy, err := skipProto(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthProto } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("bar") } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func skipProto(data []byte) (n int, err error) { l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowProto } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } wireType := int(wire & 0x7) switch wireType { case 0: for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowProto } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } iNdEx++ if data[iNdEx-1] < 0x80 { break } } return iNdEx, nil case 1: iNdEx += 8 return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowProto } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ length |= (int(b) & 0x7F) << shift if b < 0x80 { break } } iNdEx += length if length < 0 { return 0, ErrInvalidLengthProto } return iNdEx, nil case 3: for { var innerWire uint64 var start int = iNdEx for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowProto } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ innerWire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } innerWireType := int(innerWire & 0x7) if innerWireType == 4 { break } next, err := skipProto(data[start:]) if err != nil { return 0, err } iNdEx = start + next } return iNdEx, nil case 4: return iNdEx, nil case 5: iNdEx += 4 return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } } panic("unreachable") } var ( ErrInvalidLengthProto = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowProto = fmt.Errorf("proto: integer overflow") )