You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yes, embedded types are currently not recognized by the open2opaque tool.
Inside Google, we recommend against embedding protobuf generated message types into a struct. It’s an error-prone pattern, because then your struct implements the proto.Message interface by forwarding to the embedded message, which only knows about part of the struct it’s embedded in. So, for example, code which uses Go Protobuf reflection to compare two messages for equality would only operate on the proto message fields, not your additional fields.
We recommend naming the struct field, i.e.:
typeMyFoostruct {
Foo*foopkg.GeneratedFoo// some additional fields
}
For now, I recommend doing this refactoring first and then reaching for open2opaque.
If many people encounter this issue, we can see about implementing support for it (please use the thumbs up vote on the first comment of this issue to signal you also ran into the issue).
Hello, if I have a generated type embedded in another type, the tool does not recognize it for migration:
I expect:
But the tool does not recognize
MyFoo
as a type that needs migration.The text was updated successfully, but these errors were encountered: