jhump / protoreflect

Reflection (Rich Descriptors) for Go Protocol Buffers
Apache License 2.0
1.35k stars 172 forks source link

hack: change package to prevent possible init crash due to duplicate protos #555

Closed jhump closed 1 year ago

jhump commented 1 year ago

If/when https://github.com/grpc/grpc-go/issues/5684 is resolved, then a program that tries to link in both that reflection package and this repo's grpcreflect package will run into problems: both would try to register the same file descriptors and types in the protobuf runtime's global registry. That would lead to a panic during program init.

So this hacks the internal packages used for the v1 service to avoid such a conflict. It also updates the script that generates code to use a longer path that is much less likely to collide with a user's files.