vtprotobuf icon indicating copy to clipboard operation
vtprotobuf copied to clipboard

Support DiscardUnknown fields with UnmarshalVT

Open toffaletti opened this issue 4 years ago • 0 comments

https://pkg.go.dev/google.golang.org/protobuf/proto#UnmarshalOptions

Currently UnmarshalVT tracks unknownFields:

default:
 			iNdEx = preIndex
 			skippy, err := skip(dAtA[iNdEx:])
 			if err != nil {
 				return err
 			}
 			if (skippy < 0) || (iNdEx+skippy) < 0 {
 				return ErrInvalidLength
 			}
 			if (iNdEx + skippy) > l {
 				return io.ErrUnexpectedEOF
 			}
 			m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) <----
 			iNdEx += skippy

It would be helpful to have an option to discard these.

toffaletti avatar Jul 30 '21 21:07 toffaletti