Comments (5)
There are three different elements here (actually four, of which you mentioned three):
- the protobuf package name;
- the Go package import path;
- the Go package name; and
- the file name of the source file.
google.protobuf
seems like a good name for the protobuf package, since this is already well-established as being under the ownership of the protobuf project. I don't know why cpp_features.proto
and java_features.proto
are using pb
; that doesn't seem like a good name at all. Possibly these are intended to be strictly internal to the code generator, in which case the name doesn't matter? It doesn't seem likely that these will remain purely internal, though. Someone should probably open an issue in the appropriate tracker to have the name changed to something better.
It looks like when go_features.proto
moved from reflect/protodesc/proto
(initial home, never appeared in any release AFAIK), we forgot to update the regeneration script to operate on the new location, so the generated package has the wrong name (proto
, rather than gofeaturespb
) and its descriptor references the old location. We should fix that and regenerate the .pb.go
.
The file name is also stale ("reflect/protodesc/proto/go_features.proto"
), but simply regenerating the file isn't enough. Doing so would set the name to "types/gofeaturespb/go_features.proto"
, which is insufficiently qualified.
The file names for the C++ and Java files are "protobuf/compiler/cpp/cpp_features.proto"
and "protobuf/compiler/java/java_features.proto"
. Using the same pattern for Go seems reasonable. (Perhaps all three should be under "google/protobuf"
instead.)
I think the clearest way to handle this is to create a new top-level directory in the https://go.googlesource.com/protobuf repo to hold public .proto
files. Possibly src
(short, matches the main proto repo structure), moving the file to src/protobuf/compiler/go/go_features.proto
.
from protobuf.
google.protobuf seems like a good name for the protobuf package, since this is already well-established as being under the ownership of the protobuf project. I don't know why cpp_features.proto and java_features.proto are using pb; that doesn't seem like a good name at all.
This was a decision by the Protobuf team for Editions. Features are likely to appear in greater numbers in files that are "prototilled" (auto-converted from proto2 or proto3 to editions), and "pb" is a much more concise but still readable name. I was told that the internal version of go_features.proto
actually uses "pb" as the package name and that I could file a bug since it is likely a Copybara misconfiguration that changed the package in the GitHub version. Cc @mkruskal-google.
The file names for the C++ and Java files are "protobuf/compiler/cpp/cpp_features.proto" and "protobuf/compiler/java/java_features.proto"
I don't think this is accurate. From what I can see in the main protobuf repo, they use "google/protobuf/cpp_features.proto" and "google/protobuf/java_features.proto".
from protobuf.
I don't think this is accurate. From what I can see in the main protobuf repo, they use "google/protobuf/cpp_features.proto" and "google/protobuf/java_features.proto".
I could swear that I was seeing protobuf/compiler/(lang)/lang_features.proto somewhere, and now I can't find what I was looking at. You're right, these seem to be under google/protobuf.
from protobuf.
Possibly these are intended to be strictly internal to the code generator, in which case the name doesn't matter?
I don't thik so because if you want to use the features defined in these, you need to import these files and use the types deffined in them. But I agree that these names seem suboptimal.
I think the clearest way to handle this is to create a new top-level directory in the https://go.googlesource.com/protobuf repo to hold public .proto files. Possibly src (short, matches the main proto repo structure), moving the file to src/protobuf/compiler/go/go_features.proto.
Thanks for the input. I agree and prepared https://go-review.googlesource.com/c/protobuf/+/579975 to address this.
from protobuf.
The change was submitted. This should address all of your concern. If not, feel free to reopen this issue.
from protobuf.
Related Issues (20)
- Support for optional fields HOT 2
- Latest version of google.golang.org/protobuf (v1.33.0) is no longer compatible with the latest version of github.com/golang/protobuf (v1.5.3) HOT 7
- Add option to JSON marshal / unmarshal: StripEnumPrefix / AddEnumPrefix HOT 10
- How to properly define protobuf `oneof` fields? HOT 2
- How can I import a pre-compiled proto from another package? HOT 4
- protodesc: feature "message_encoding" (in Protobuf editions) triggers proto2 group validation checks HOT 11
- timestamppb.AsTime is incorrectly implemented for nil/zero values HOT 2
- missing replace in go.mod HOT 1
- protojson: fail to unmarshal JSON with reserved fields HOT 19
- Parsing protoc plugin option containing ',' HOT 5
- Tracking issue: Fully Lazy Extension decoding HOT 4
- feature: Generate test client / `bufconn` constructors HOT 4
- v1.33.0 breaks bazel build HOT 14
- Reflection: protopath parsing and path+message access HOT 7
- Proposal: Set go.mod Go language version to oldest supported Go version (1.21 currently) HOT 8
- Proposal: Add `Override` mode to `proto.Merge` HOT 2
- editions: maps are incorrectly serialized if file has default message encoding of DELIMITED HOT 5
- protodesc: too strict about proto3 field names when creating descriptors from FileDescriptorProto
- undefined: descriptorpb.Default_FileOptions_PhpGenericServices HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from protobuf.