DefaultPackageName returns the package name printed for the object. If its file is in a different package, it returns the package name we're using for this file, plus ".". Otherwise it returns the empty string.
(obj Object)
| 504 | // If its file is in a different package, it returns the package name we're using for this file, plus ".". |
| 505 | // Otherwise it returns the empty string. |
| 506 | func (g *Generator) DefaultPackageName(obj Object) string { |
| 507 | importPath := obj.GoImportPath() |
| 508 | if importPath == g.outputImportPath { |
| 509 | return "" |
| 510 | } |
| 511 | return string(g.GoPackageName(importPath)) + "." |
| 512 | } |
| 513 | |
| 514 | // GoPackageName returns the name used for a package. |
| 515 | func (g *Generator) GoPackageName(importPath GoImportPath) GoPackageName { |
no test coverage detected