github.com/renbou/grpcbridge@v0.0.2-0.20240416012907-bcbd8b12648a/internal/bridgetest/pb.go (about) 1 package bridgetest 2 3 import ( 4 "sync" 5 6 "google.golang.org/protobuf/reflect/protoregistry" 7 ) 8 9 var emptyOnce sync.Once 10 11 // EmptyGlobalProtoRegistry empties the global proto registries, 12 // which is needed for testing to simulate lack of PB information in grpcbridge's global registries, 13 // as it will be during real use where proto registries are constructed on the fly for each target. 14 func EmptyGlobalProtoRegistry() { 15 emptyOnce.Do(func() { 16 protoregistry.GlobalFiles = new(protoregistry.Files) 17 protoregistry.GlobalTypes = new(protoregistry.Types) 18 }) 19 }