github.com/cosmos/cosmos-proto@v1.0.0-beta.3/features/fastreflection/copied/naming.go (about) 1 package copied 2 3 import ( 4 "strings" 5 "unicode/utf8" 6 7 "google.golang.org/protobuf/compiler/protogen" 8 ) 9 10 func fileVarName(f *protogen.File, suffix string) string { 11 prefix := f.GoDescriptorIdent.GoName 12 _, n := utf8.DecodeRuneInString(prefix) 13 prefix = strings.ToLower(prefix[:n]) + prefix[n:] 14 return prefix + "_" + suffix 15 } 16 17 func MessageTypesVarName(f *FileInfo) string { 18 return fileVarName(f.File, "msgTypes") 19 } 20 21 func InitFunctionName(f *protogen.File) string { 22 return fileVarName(f, "init") 23 }