resolved some comments
This commit is contained in:
@ -104,9 +104,12 @@ const string GetFullMessageQualifiedName(
|
|||||||
map<string, string>& import_alias) {
|
map<string, string>& import_alias) {
|
||||||
string pkg = GenerateFullGoPackage(desc->file());
|
string pkg = GenerateFullGoPackage(desc->file());
|
||||||
if (imports.find(pkg) == imports.end()) {
|
if (imports.find(pkg) == imports.end()) {
|
||||||
|
// The message is in the same package as the services definition.
|
||||||
return desc->name();
|
return desc->name();
|
||||||
}
|
}
|
||||||
if (import_alias.find(pkg) != import_alias.end()) {
|
if (import_alias.find(pkg) != import_alias.end()) {
|
||||||
|
// The message is in a package whose name is as same as the one consisting
|
||||||
|
// of the service definition. Use the alias to differentiate.
|
||||||
return import_alias[pkg] + "." + desc->name();
|
return import_alias[pkg] + "." + desc->name();
|
||||||
}
|
}
|
||||||
return BadToUnderscore(desc->file()->package()) + "." + desc->name();
|
return BadToUnderscore(desc->file()->package()) + "." + desc->name();
|
||||||
@ -565,7 +568,7 @@ void PrintMessageImports(
|
|||||||
string pkg = GenerateFullGoPackage(fd);
|
string pkg = GenerateFullGoPackage(fd);
|
||||||
if (pkg != "") {
|
if (pkg != "") {
|
||||||
auto ret = imports->insert(pkg);
|
auto ret = imports->insert(pkg);
|
||||||
if (ret.second == true && file->package() == fd->package()) {
|
if (ret.second && file->package() == fd->package()) {
|
||||||
// the same package name in different directories. Require an alias.
|
// the same package name in different directories. Require an alias.
|
||||||
(*import_alias)[pkg] = "apb" + std::to_string(idx++);
|
(*import_alias)[pkg] = "apb" + std::to_string(idx++);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user