I suppose the best way is to use namespaced naming for the imported packages

[Joop Kiefte - Chat @ 
Spike](https://spikenow.com/r/a/?ref=spike-organic-signature&_ts=pgu9m)   
[pgu9m]

On September 30, 2020 at 17:47 GMT, Denis Cheremisov 
<denis.cheremi...@gmail.com> wrote:

It is because you import protoc-gen-go generated entities with exactly the same 
package name and their own name. This is not allowed with protobuf, you can 
only have a single <pkg name>.<entity name>. You can either use different names 
for error packages or use a 3rd repository with generated code.

среда, 30 сентября 2020 г. в 18:14:04 UTC+3, va...@selfip.ru:

server https://github.com/unistack-org/micro-server-grpc
client https://github.com/unistack-org/micro-client-grpc
code used both repos 
https://github.com/unistack-org/micro-tests/tree/master/server/grpc

ср, 30 сент. 2020 г. в 16:41, Joop Kiefte <iko...@gmail.com>:

This seems to be because the protocol buffer packages rely on shared state, 
kinda similar to the registration of database drivers in database/sql I would 
say (correct me if I'm wrong). I don't know how you import them, but you 
probably need a way to strictly separate the two in your program (example code 
would help to give more specific advice...).

[Joop Kiefte - Chat @ 
Spike](https://spikenow.com/r/a/?ref=spike-organic-signature&_ts=pgfpn)   
[pgfpn]

On September 30, 2020 at 13:26 GMT, Vasiliy Tolstov <v.to...@selfip.ru> wrote:

So nobody knows how to deal with this? And if some projects have proto
files with the same name - protobuf always complain about it?

вт, 29 сент. 2020 г. в 10:50, Vasiliy Tolstov <v.to...@selfip.ru>:
>
> Hi! I have two packages server and client. All belongs to different
> repos. In this packages i have internal/errors dir with errors.proto
> file
> Both of them contains go_package option and package unique
>
> option go_package = "xxx.org/server/internal/errors";
> package server.errors;
>
> option go_package = "xxx.org/client/internal/errors";
> package client.errors;
>
> why program that used client and server in the same time have such message
>
> 2020/09/29 10:50:18 WARNING: proto: file "errors.proto" is already registered
> previously from: ""xxx.org/server/internal/errors"
> currently from: ""xxx.org/client/internal/errors"
> A future release will panic on registration conflicts. See:
> https://developers.google.com/protocol-buffers/docs/reference/go/faq#namespace-conflict
>
> --
> Vasiliy Tolstov,
> e-mail: v.to...@selfip.ru

--
Vasiliy Tolstov,
e-mail: v.to...@selfip.ru

--
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsub...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CACaajQvaGd8j2MD75EkRvH6zxD89gyKLunxXL6Q5%3DN9VkKWWhQ%40mail.gmail.com.

--
Vasiliy Tolstov,
e-mail: v.to...@selfip.ru

--
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
[https://groups.google.com/d/msgid/golang-nuts/5df715d7-ba19-46e5-ad1d-1c5dd5c896ddn%40googlegroups.com](https://groups.google.com/d/msgid/golang-nuts/5df715d7-ba19-46e5-ad1d-1c5dd5c896ddn%40googlegroups.com?utm_medium=email&utm_source=footer).

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/c-64693-kfpr24zu-ayispd%3D1nidd5m%402.gethop.com.

Reply via email to