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

Function cleanPackageName

protoc-gen-go/generator/generator.go:622–633  ·  view source on GitHub ↗
(name string)

Source from the content-addressed store, hash-verified

620}
621
622func cleanPackageName(name string) GoPackageName {
623 name = strings.Map(badToUnderscore, name)
624 // Identifier must not be keyword or predeclared identifier: insert _.
625 if isGoKeyword[name] {
626 name = "_" + name
627 }
628 // Identifier must not begin with digit: insert _.
629 if r, _ := utf8.DecodeRuneInString(name); unicode.IsDigit(r) {
630 name = "_" + name
631 }
632 return GoPackageName(name)
633}
634
635// defaultGoPackage returns the package name to use,
636// derived from the import path of the package we're building code for.

Callers 5

goPackageOptionMethod · 0.85
GoPackageNameMethod · 0.85
defaultGoPackageMethod · 0.85
SetPackageNamesMethod · 0.85

Calls 1

GoPackageNameTypeAlias · 0.85

Tested by

no test coverage detected