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

Method defaultGoPackage

protoc-gen-go/generator/generator.go:637–643  ·  view source on GitHub ↗

defaultGoPackage returns the package name to use, derived from the import path of the package we're building code for.

()

Source from the content-addressed store, hash-verified

635// defaultGoPackage returns the package name to use,
636// derived from the import path of the package we're building code for.
637func (g *Generator) defaultGoPackage() GoPackageName {
638 p := g.PackageImportPath
639 if i := strings.LastIndex(p, "/"); i >= 0 {
640 p = p[i+1:]
641 }
642 return cleanPackageName(p)
643}
644
645// SetPackageNames sets the package name for this run.
646// The package name must agree across all files being generated.

Callers 1

SetPackageNamesMethod · 0.95

Calls 1

cleanPackageNameFunction · 0.85

Tested by

no test coverage detected