Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for proto extensions? #62

Open
dontonka opened this issue Sep 20, 2022 · 1 comment
Open

Adding support for proto extensions? #62

dontonka opened this issue Sep 20, 2022 · 1 comment

Comments

@dontonka
Copy link

I'm using protobuf and trying this plugin, but seems like it's lacking the support for extensionFields 🤔? Am I right, or misunderstanding something here?

@dontonka
Copy link
Author

Seems like UnmarshalVT is compatible, but not MarshalVT.

Here is a snipet of UnmarshalVT implementation generated, for proto extensions (fieldNum is > than 1000 and fallback on the non-vtProto implementation)

		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
			}
			if (fieldNum >= 100) && (fieldNum < 10000) {
				err = proto.UnmarshalOptions{AllowPartial: true}.Unmarshal(dAtA[iNdEx:iNdEx+skippy], m)
				if err != nil {
					return err
				}
				iNdEx += skippy
			} else {
				m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
				iNdEx += skippy
			}
		}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant