From 6e7dbc435c7728d35b8dc18d9e706961cc0d18c5 Mon Sep 17 00:00:00 2001 From: Marco Pracucci Date: Sat, 19 Oct 2019 12:38:24 +0200 Subject: [PATCH] Fix compiled logproto protobuf --- Makefile | 2 ++ pkg/logproto/logproto.pb.go | 62 +++++++++++-------------------------- 2 files changed, 20 insertions(+), 44 deletions(-) diff --git a/Makefile b/Makefile index ab290c3065a45..e3616f07a4b6b 100644 --- a/Makefile +++ b/Makefile @@ -263,6 +263,8 @@ endif protos: $(PROTO_GOS) +# Ensure protobuf is recompiled when the tooling is updated and proto sources are not +.PHONY: $(PROTO_DEFS) %.pb.go: $(PROTO_DEFS) ifeq ($(BUILD_IN_CONTAINER),true) @mkdir -p $(shell pwd)/.pkg diff --git a/pkg/logproto/logproto.pb.go b/pkg/logproto/logproto.pb.go index 85dbc32717cc7..882c45f6483c1 100644 --- a/pkg/logproto/logproto.pb.go +++ b/pkg/logproto/logproto.pb.go @@ -1459,9 +1459,9 @@ func (this *Stream) GoString() string { s = append(s, "&logproto.Stream{") s = append(s, "Labels: "+fmt.Sprintf("%#v", this.Labels)+",\n") if this.Entries != nil { - vs := make([]*Entry, len(this.Entries)) + vs := make([]Entry, len(this.Entries)) for i := range vs { - vs[i] = &this.Entries[i] + vs[i] = this.Entries[i] } s = append(s, "Entries: "+fmt.Sprintf("%#v", vs)+",\n") } @@ -4857,6 +4857,7 @@ func (m *TransferChunksResponse) Unmarshal(dAtA []byte) error { func skipLogproto(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 + depth := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { @@ -4888,10 +4889,8 @@ func skipLogproto(dAtA []byte) (n int, err error) { break } } - return iNdEx, nil case 1: iNdEx += 8 - return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { @@ -4912,55 +4911,30 @@ func skipLogproto(dAtA []byte) (n int, err error) { return 0, ErrInvalidLengthLogproto } iNdEx += length - if iNdEx < 0 { - return 0, ErrInvalidLengthLogproto - } - return iNdEx, nil case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowLogproto - } - 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 := skipLogproto(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - if iNdEx < 0 { - return 0, ErrInvalidLengthLogproto - } - } - return iNdEx, nil + depth++ case 4: - return iNdEx, nil + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupLogproto + } + depth-- case 5: iNdEx += 4 - return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } + if iNdEx < 0 { + return 0, ErrInvalidLengthLogproto + } + if depth == 0 { + return iNdEx, nil + } } - panic("unreachable") + return 0, io.ErrUnexpectedEOF } var ( - ErrInvalidLengthLogproto = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowLogproto = fmt.Errorf("proto: integer overflow") + ErrInvalidLengthLogproto = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowLogproto = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupLogproto = fmt.Errorf("proto: unexpected end of group") )