gogo / protobuf

[Deprecated] Protocol Buffers for Go with Gadgets
Other
5.66k stars 806 forks source link

using partial package name causes duplicate proto type registered #349

Open savaki opened 6 years ago

savaki commented 6 years ago

We have an app with numerous protobuf packages and we're starting to see duplicate proto type registered errors because gogo only uses a partial package name to identify the type. Instead, gogo should use the entire package name to fully qualify the type.

Consider examples within the go pkgs that would cause this issue:

html/template text/template

If these packages used gogo, they would have the issue because gogo only uses template as the package name rather than html/template and text/template

awalterschulze commented 6 years ago

Does golang/protobuf give you the same problem or is it just gogo?

On Sun, 29 Oct 2017, 16:07 Matt Ho, notifications@github.com wrote:

We have an app with numerous protobuf packages and we're starting to see duplicate proto type registered errors because gogo only uses a partial package name to identify the type. Instead, gogo should use the entire package name to fully qualify the type.

Consider examples within the go pkgs that would cause this issue:

html/template text/template

If these packages used gogo, they would have the issue because gogo only uses template as the package name rather than html/template and text/template

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/gogo/protobuf/issues/349, or mute the thread https://github.com/notifications/unsubscribe-auth/ABvsLYy45q18P8S7Z-EyqTJY-ccw1ZCfks5sxJTKgaJpZM4QKWH6 .

savaki commented 6 years ago

Looks like golang/protobuf also has the same issue

awalterschulze commented 6 years ago

Could you please report it there? Then I can merge in the fix, since gogoprotobuf is a fork of golang/protobuf.

kuba-- commented 6 years ago

So question - when you're registering a type, can you add a check if type is already registered, e.g.: if t := proto.MessageType("type name"); t == nil { // register } instead of logging a message proto: duplicate proto type registered