MCPcopy
hub / github.com/golang/protobuf / DefaultPackageName

Method DefaultPackageName

protoc-gen-go/generator/generator.go:506–512  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
506func (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.
515func (g *Generator) GoPackageName(importPath GoImportPath) GoPackageName {

Callers 3

TypeNameMethod · 0.95
getterDefaultMethod · 0.95

Calls 2

GoPackageNameMethod · 0.95
GoImportPathMethod · 0.65

Tested by

no test coverage detected