mirror of
https://github.com/protocolbuffers/protobuf-go.git
synced 2025-03-09 22:13:27 +00:00
protogen: avoid an obscure package name consistency check failure
When performing consistency checks on package names, ignore files that are mentioned on the command line (M<filename>=<import_path>) but which do not appear in the CodeGeneratorRequest. Change-Id: I51f1eeda5eaaac14f4a0a975163f65d7774e7212 Reviewed-on: https://go-review.googlesource.com/c/140717 Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
This commit is contained in:
parent
daa4fad986
commit
bbbd38f9f9
@ -275,6 +275,11 @@ func New(req *pluginpb.CodeGeneratorRequest, opts *Options) (*Plugin, error) {
|
||||
// the same Go package name.
|
||||
packageFiles := make(map[GoImportPath][]string)
|
||||
for filename, importPath := range importPaths {
|
||||
if _, ok := packageNames[filename]; !ok {
|
||||
// Skip files mentioned in a M<file>=<import_path> parameter
|
||||
// but which do not appear in the CodeGeneratorRequest.
|
||||
continue
|
||||
}
|
||||
packageFiles[importPath] = append(packageFiles[importPath], filename)
|
||||
}
|
||||
for importPath, filenames := range packageFiles {
|
||||
|
Loading…
x
Reference in New Issue
Block a user