-
Notifications
You must be signed in to change notification settings - Fork 15.3k
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
plugin.proto and descriptor.proto contains the wrong go_package #1289
Comments
@neild could you weigh in on this? Should we change |
(Sorry for the delay, traveling.) Here's what I'm seeing for descriptor.proto: That looks right to me. (The /protoc-gen-go/ is pretty unfortunate, but there are historical reasons for it.) plugin.proto's go_package looks wrong, though: That should either be "github.com/golang/protobuf/protoc-gen-go/plugin;plugin_go" or "github.com/golang/protobuf/protoc-gen-go/plugin;plugin". The former matches the pregenerated in the Go protobuf repo, but the latter is the better choice if we don't worry about compatibility. To expand on that: The import path for the generated package for plugin.proto is "github.com/golang/protobuf/protoc-gen-go/plugin". By Go convention, we would expect the package name to be the last component of the import path: "plugin". However, the generated package in the github.com/golang/protobuf repo is using the package name "plugin_go". If we change the name to "plugin", we break anyone depending on the existing name. I don't know whether anyone does depend on it. I'm inclined to say that we should stick with the existing, unfortunate, package name, in which case the go_package option should be set to "github.com/golang/protobuf/protoc-gen-go/plugin;plugin_go". I'm happy to hear arguments for changing the package name, however. |
For more info see: protocolbuffers#1289
For more info see: protocolbuffers#1289
plugin.proto's go_package is currently set to "plugin_go". It should be set to "compiler" because protoc-gen-go will place generated files into google/protobuf/compiler.
Similarly, descriptor.proto's go_package is currently set to "descriptor". It should be set to "protobuf".
In 2.6.1, both proto files contained no go_package statement. While not ideal, this at least allowed the package name to be specified in the --go_out=import_path parameters. In 3.0.0, it's currently impossible (to the best of my knowledge) to generate valid Go for plugin.proto and descriptor.proto without modifications.
The text was updated successfully, but these errors were encountered: