mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2024-12-28 00:19:55 +00:00
8b366e8807
Since the release of v1.20, we have warned that it be required that the import path for every generated package be specified. This CL simplifies the mechanism for specifying such information to just the "M" command-line flags and the "go_package" options in the .proto source files, where the former takes precedence over the latter. Changes made: * Remove "import_prefix" and "import_path" flags. * Make the Go import path and package name derivation logic simpler where both "M" flags and "go_package" options are parsed the same way by calling the common splitImportPathAndPackageName function, and where "M" flags take precedence over "go_package" options. The exception to this occurs when neither "M" nor "go_package" specify an explicit Go package name, where the derivation may be non-intuitive. See the "NOTE" comment for the rationale for this behavior, which actually matches what was already the case. * Remove the pathTypeLegacy output mode and make pathTypeImport the default. The pathTypeLegacy mode becomes even more non-sensible now that we require that the import path always be provided. * Remove the baseName function. After deleting unsupported functionality, this seems to only be used by GeneratedFile.QualifiedGoIdent. However, that method does not need to create stable package names since they are only used locally within the generated file. They only need to guarantee the property of validity and uniqueness. * Remove the warn function since there are no more warnings. Change-Id: Ic95fb3cde5ffcb71bbcc829fcff34369758cebef Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/301953 Trust: Joe Tsai <joetsai@digital-static.net> Reviewed-by: Damien Neil <dneil@google.com> |
||
---|---|---|
.. | ||
protogen_test.go | ||
protogen.go |