Skip to content

Commit

Permalink
fix(protogen): drop unnecessary package name check
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Stewart <[email protected]>
  • Loading branch information
paralin committed Mar 22, 2024
1 parent bf28975 commit d24fc1b
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions compiler/protogen/protogen.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,26 +288,6 @@ func (opts Options) New(req *pluginpb.CodeGeneratorRequest) (*Plugin, error) {
}
}

// Consistency check: Every file with the same Go import path should have
// 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 {
for i := 1; i < len(filenames); i++ {
if a, b := packageNames[filenames[0]], packageNames[filenames[i]]; a != b {
return nil, fmt.Errorf("Go package %v has inconsistent names %v (%v) and %v (%v)",
importPath, a, filenames[0], b, filenames[i])
}
}
}

// The extracted types from the full import set
typeRegistry := newExtensionRegistry()
for _, fdesc := range gen.Request.ProtoFile {
Expand Down

0 comments on commit d24fc1b

Please sign in to comment.