In #258 I made a proof of concept for using google.golang.org/protobuf/reflect/protoreflect descriptors instead of the the descriptors defined in linker/descriptors.go.
google.golang.org/protobuf/reflect/protodesc offers an API to turn file descriptor protos into protobuf/protoreflect descriptors. To be able to use this API on the descriptors that are generated by the parser the well-known options need to be resolved.
This means the current execution needs to change from:
- parsing
- linking (done by code in linker/)
- resolving options
to
- parsing
- resolving well-known options
- linking (done by reflect/protodesc)
- resolving not well-known options
In my experiments this was all that was needed but I don't know how good the test coverage of my experiments was.
Another issue might be that the reflect/protodesc validation is stricter than the linker/descriptors.go validation and thus the API would become more restrictive (backwards incompatible change).
I'm not saying this is the only (or even best) way forward but might be an option to consider to reduce the maintanence cost because protocompile would not need to maintain its own descriptor implementation.