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
Golang's protobuf compiler bakes the name of the file used during compilation directly inside the generated source file, and tries to register it (see this long running thread golang/protobuf#1122).
Registering multiple files with the same name causes errors. This is not a blocking issue, since protoc will take the full path used, so running protoc a/common.proto and protoc b/common.proto will work, even if protoc -I a common.proto and protoc -I b common.proto will not.
Currently, the SDK is compiling (at least some of) its proto files, without prefixing them with any sort of path. This causes potential conflicts with projects importing the sdk. It would help reducing some friction if the proto files were compiled using a clear path.
I encountered this with the common.proto file, as our project also has a file with that name. While fixable on our end, it caused a lot of reworking our build process.
The text was updated successfully, but these errors were encountered:
The paths where the files live does not matter, it's how protoc is called on them that does.
For instance, if you do protoc proto/common.proto it will reserve the name proto/common.proto, but if you do protoc -I proto common.proto it will reserve the name common.proto.
In go (at least using the common protobuf package), the name will become unusable for any other project trying to register the same name.
Ideally, the path should contain a reference to your repo/org, for instance, google's protobuf files usually live under google/... and we compile them by importing that whole directory.
On the other hand, this sdk comes with pre-compiled proto files, which have been generated without any prefix.
If you find you agree and want to fix it, it's a matter of recompiling the proto using appropriate scope for your include directives. It likely means changing the import directives in your .proto files to match the path as well.
So something like having files live under proto/hedera/..., replacing your imports with import "hedera/...", and then compiling with protoc -I proto hedera/...
Hello,
Golang's protobuf compiler bakes the name of the file used during compilation directly inside the generated source file, and tries to register it (see this long running thread golang/protobuf#1122).
Registering multiple files with the same name causes errors. This is not a blocking issue, since
protoc
will take the full path used, so runningprotoc a/common.proto
andprotoc b/common.proto
will work, even ifprotoc -I a common.proto
andprotoc -I b common.proto
will not.Currently, the SDK is compiling (at least some of) its proto files, without prefixing them with any sort of path. This causes potential conflicts with projects importing the sdk. It would help reducing some friction if the proto files were compiled using a clear path.
I encountered this with the
common.proto
file, as our project also has a file with that name. While fixable on our end, it caused a lot of reworking our build process.The text was updated successfully, but these errors were encountered: