jhump / protoreflect

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

desc: fix caching when wrapping protoreflect.Descriptor instances #606

Closed jhump closed 6 months ago

jhump commented 6 months ago

Several places used a noopCache, which could lead to issues if the same file appears in the root element's transitive dependencies more than once.

This fixes a similar issue in desc.WrapFiles -- though it uses a mapCache, it wasn't previously checking it for the files explicitly given. So if one of the explicitly named files was also in the transitive dependencies of an earlier named file, it would get wrapped more than once. This was the cause of https://github.com/fullstorydev/grpcurl/issues/417.