commit | 4069211bcd6dea4f65a13dcd99d76adcdbf52b85 | [log] [tgz] |
---|---|---|
author | Joe Tsai <joetsai@digital-static.net> | Wed Feb 27 20:25:51 2019 -0800 |
committer | Joe Tsai <thebrokentoaster@gmail.com> | Fri Mar 01 00:13:31 2019 +0000 |
tree | 761d10e5ae19ff90e9fa3b36ca2bf63e19b2d534 | |
parent | cf81e67b53dcc6c4317c057841f49a54a7b32463 [diff] |
protogen: use full path for generated file variable name Use the full path (including the extension) for the generation of the per-file variable name. Several reasons for this: * The current logic is buggy in the case where pathType == pathTypeImport since the prefix variable will be mangled with the Go import path. * The extension is technically part of the path. Thus, "path/to/foo.proto" and "path/to/foo.protodevel" are two distinctly different imports. * Style-wise, it subjectively looks better. Rather than being a mixture of camelCase and snake_case, it is all snake_case for the common case: before: ProtoFile_google_protobuf_any after: File_google_protobuf_any_proto * Since the extension is almost always ".proto", this results in a suffix of "_proto", which provides an additional layer of protection against possible name conflicts. The previous approach could possibly have a conflict between "Foo.proto" and a message named ProtoFile with a sub-message called Foo. Also, use the per-file variable name for the raw descriptor variables instead of the hashed version. Change-Id: Ic91e326b7593e5985cee6ececc60539c27fe32fe Reviewed-on: https://go-review.googlesource.com/c/164379 Reviewed-by: Damien Neil <dneil@google.com>
WARNING: This repository is in active development. There are no guarantees about API stability. Breaking changes will occur until a stable release is made and announced.
This repository is for the development of the next major Go implementation of protocol buffers. This library makes breaking API changes relative to the existing Go protobuf library. Of particular note, this API aims to make protobuf reflection a first-class feature of the API and implements the protobuf ecosystem in terms of reflection.
List of relevant design documents:
We appreciate community contributions. See CONTRIBUTING.md.
Issues regarding the new API can be filed at github.com/golang/protobuf. Please use a APIv2:
prefix in the title to make it clear that the issue is regarding the new API work.