-
Notifications
You must be signed in to change notification settings - Fork 68
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
Consider isolating protobuf files to avoid conflicts with other projects #1177
Comments
Hi @CMajeri , thanks for bringing this up. We will look into it. |
The proto generated files live in |
The paths where the files live does not matter, it's how For instance, if you do Ideally, the path should contain a reference to your repo/org, for instance, google's protobuf files usually live under 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 So something like having files live under |
The protoc command that we use looks something like this: I think we do have a prefix. |
All our |
This is very easy to reproduce: I create two files: package main
import (
"fmt"
"github.com/hiero-ledger/hiero-sdk-go/v2/proto/services"
)
func main() {
tx := services.Transaction{}
fmt.Println("Hello world", tx)
} And syntax = "proto3";
option go_package = ".;main";
message MyMessage {
uint64 entry = 1;
} And then
Additionally, this is a snippet from the
^ Note the |
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: