func (m *A) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Strings != nil { data[i] = 0xa i++ i = encodeVarintVanity(data, i, uint64(len(*m.Strings))) i += copy(data[i:], *m.Strings) } if m.Int == nil { return 0, github_com_gogo_protobuf_proto.NewRequiredNotSetError("Int") } else { data[i] = 0x10 i++ i = encodeVarintVanity(data, i, uint64(*m.Int)) } if m.XXX_unrecognized != nil { i += copy(data[i:], m.XXX_unrecognized) } return i, nil }
func (m *A) 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 ErrIntOverflowVanity } 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: A: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: A: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Strings", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowVanity } if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthVanity } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } m.Strings = string(data[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Int", wireType) } m.Int = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowVanity } if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ m.Int |= (int64(b) & 0x7F) << shift if b < 0x80 { break } } hasFields[0] |= uint64(0x00000001) default: iNdEx = preIndex skippy, err := skipVanity(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthVanity } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if hasFields[0]&uint64(0x00000001) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Int") } if iNdEx > l { return io.ErrUnexpectedEOF } return nil }
func (m *IntMerge) 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 ErrIntOverflowUnmarshalmerge } 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: IntMerge: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: IntMerge: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Int64", wireType) } m.Int64 = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowUnmarshalmerge } if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ m.Int64 |= (int64(b) & 0x7F) << shift if b < 0x80 { break } } hasFields[0] |= uint64(0x00000001) case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Int32", wireType) } m.Int32 = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowUnmarshalmerge } if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ m.Int32 |= (int32(b) & 0x7F) << shift if b < 0x80 { break } } case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Sint32", wireType) } var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowUnmarshalmerge } if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (int32(b) & 0x7F) << shift if b < 0x80 { break } } v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) m.Sint32 = v hasFields[0] |= uint64(0x00000002) case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Sint64", wireType) } var v uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowUnmarshalmerge } if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } v = (v >> 1) ^ uint64((int64(v&1)<<63)>>63) m.Sint64 = int64(v) case 5: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Uint64", wireType) } m.Uint64 = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowUnmarshalmerge } if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ m.Uint64 |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } case 6: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Uint32", wireType) } m.Uint32 = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowUnmarshalmerge } if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ m.Uint32 |= (uint32(b) & 0x7F) << shift if b < 0x80 { break } } hasFields[0] |= uint64(0x00000004) case 7: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field Fixed64", wireType) } m.Fixed64 = 0 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } iNdEx += 8 m.Fixed64 = uint64(data[iNdEx-8]) m.Fixed64 |= uint64(data[iNdEx-7]) << 8 m.Fixed64 |= uint64(data[iNdEx-6]) << 16 m.Fixed64 |= uint64(data[iNdEx-5]) << 24 m.Fixed64 |= uint64(data[iNdEx-4]) << 32 m.Fixed64 |= uint64(data[iNdEx-3]) << 40 m.Fixed64 |= uint64(data[iNdEx-2]) << 48 m.Fixed64 |= uint64(data[iNdEx-1]) << 56 case 8: if wireType != 5 { return fmt.Errorf("proto: wrong wireType = %d for field Fixed32", wireType) } m.Fixed32 = 0 if (iNdEx + 4) > l { return io.ErrUnexpectedEOF } iNdEx += 4 m.Fixed32 = uint32(data[iNdEx-4]) m.Fixed32 |= uint32(data[iNdEx-3]) << 8 m.Fixed32 |= uint32(data[iNdEx-2]) << 16 m.Fixed32 |= uint32(data[iNdEx-1]) << 24 case 9: if wireType != 5 { return fmt.Errorf("proto: wrong wireType = %d for field Sfixed32", wireType) } m.Sfixed32 = 0 if (iNdEx + 4) > l { return io.ErrUnexpectedEOF } iNdEx += 4 m.Sfixed32 = int32(data[iNdEx-4]) m.Sfixed32 |= int32(data[iNdEx-3]) << 8 m.Sfixed32 |= int32(data[iNdEx-2]) << 16 m.Sfixed32 |= int32(data[iNdEx-1]) << 24 hasFields[0] |= uint64(0x00000008) case 10: if wireType != 1 { return fmt.Errorf("proto: wrong wireType = %d for field Sfixed64", wireType) } m.Sfixed64 = 0 if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } iNdEx += 8 m.Sfixed64 = int64(data[iNdEx-8]) m.Sfixed64 |= int64(data[iNdEx-7]) << 8 m.Sfixed64 |= int64(data[iNdEx-6]) << 16 m.Sfixed64 |= int64(data[iNdEx-5]) << 24 m.Sfixed64 |= int64(data[iNdEx-4]) << 32 m.Sfixed64 |= int64(data[iNdEx-3]) << 40 m.Sfixed64 |= int64(data[iNdEx-2]) << 48 m.Sfixed64 |= int64(data[iNdEx-1]) << 56 case 11: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Bool", wireType) } var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowUnmarshalmerge } if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (int(b) & 0x7F) << shift if b < 0x80 { break } } m.Bool = bool(v != 0) default: iNdEx = preIndex skippy, err := skipUnmarshalmerge(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthUnmarshalmerge } 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("Int64") } if hasFields[0]&uint64(0x00000002) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Sint32") } if hasFields[0]&uint64(0x00000004) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Uint32") } if hasFields[0]&uint64(0x00000008) == 0 { return github_com_gogo_protobuf_proto.NewRequiredNotSetError("Sfixed32") } if iNdEx > l { return io.ErrUnexpectedEOF } return nil }
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 }