Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proto: file "steammessages_base.proto" has a name conflict over CMsgProtoBufHeader #124

Open
jannislehmann opened this issue Feb 10, 2022 · 3 comments
Labels

Comments

@jannislehmann
Copy link

jannislehmann commented Feb 10, 2022

Hey!

I really enjoy working with your library. However, with the new protobuf library from Google, I am running into the following issue:

panic: proto: file "steammessages_base.proto" has a name conflict over CMsgProtoBufHeader
        previously from: "github.com/Philipp15b/go-steam/v3/csgo/protocol/protobuf"
        currently from:  "github.com/Philipp15b/go-steam/v3/protocol/protobuf"
See https://developers.google.com/protocol-buffers/docs/reference/go/faq#namespace-conflict

This seems to be caused by the default init in the protobuf packages.
Since both the csgo/protocol/protobuf and the protocol/protobuf package declare the same base protobufs, there seems to be a conflict.

I am only importing github.com/Philipp15b/go-steam/v3/csgo/protocol/protobuf in my code. But I would guess that the other package is being imported automatically by a package in the background.

Does anyone have a idea how to fix that issue? Merging the protobufs into one directory would be a solution, but not the prettiest solution.

Update: I guess that a fix could be implemented in this projects generator. We should try to use the same base protobufs and not duplicate the definitions.

@Philipp15b
Copy link
Owner

Hi! That seems to be a serious problem, thanks for reporting. Since there are actually multiple declarations of e.g. CMsgProtoBufHeader in the .proto files, I fear it may be very fiddly to update the generator to handle these. For underworlds, there is even a different declaration with the same name (we don't generate for underworlds yet, but still).

It might be easier to pass different package names to the generator (https://developers.google.com/protocol-buffers/docs/reference/go-generated#package). This may have some side-effects which I'm not sure I understand completely, but it should fix the naming conflict. What do you think?

@Philipp15b Philipp15b added the bug label Feb 13, 2022
@jannislehmann
Copy link
Author

First of all, thanks for the quick follow-up.
I haven't had the time to look at the generator thoroughly, but I agree that it seems rather difficult to implement a way of merging duplicate protobufs.

Changing the package names should at least work and would definitely be worth a try.
I don't even think that there will be many or even any side-effects, but I am not too familiar with the code base, yet.

jannislehmann pushed a commit to jannislehmann/csgo-microservices that referenced this issue Feb 14, 2022
@jannislehmann
Copy link
Author

Just a quick update. I have tested my application with the GOLANG_PROTOBUF_REGISTRATION_CONFLICT=warn go run main.go env var. This worked for both logging into the Steam network and working with the CSGO GameCoordinator.
This might not be the best solution, but works as a workaround at least.

From that experiment, I think, changing the package names, should not result in side-effects actually. So this should be worth a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants