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

Provide API for hacking around path problems with linking file descriptors #147

Closed
jhump opened this issue Aug 3, 2018 · 0 comments
Closed

Comments

@jhump
Copy link
Owner

jhump commented Aug 3, 2018

Due to golang/protobuf#567, file descriptor registration in the protobuf runtime is error-prone. If a file uses a relative path in an import statement that does not precisely match the path given to protoc to generate that file's corresponding Go code, then linking of descriptors can fail.

A possible work-around is to provide an API for users to register aliases for file paths. For example, a file may have been compiled with protoc and thus registered at runtime as foo.proto, but another file might import the same file via import "misc/foo.proto"; (e.g. with misc/ added to path). The API would allow users to register "misc/foo.proto" as an alias for "foo.proto". Since registration is global, the aliases can probably safely be global, too (e.g. registered in a package variable map [protected by mutex for thread-safety] that is queried from any calls to desc.LoadFileDescriptor).

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

No branches or pull requests

1 participant