github.com/songzhibin97/gkit@v1.2.13/parser/parse_pb/transform.go (about) 1 package parse_pb 2 3 var PbToGoMapping = map[string]string{ 4 "double": "float64", 5 "float": "float32", 6 "int32": "int32", 7 "uint32": "uint32", 8 "uint64": "uint64", 9 "sint32": "int32", 10 "sint64": "int64", 11 "fixed32": "uint32", 12 "fixed64": "uint64", 13 "sfixed32": "int32", 14 "sfixed64": "int64", 15 "bool": "bool", 16 "string": "string", 17 "bytes": "[]byte", 18 } 19 20 // PbTypeToGo go type 转化成 pb type 21 func PbTypeToGo(s string) string { 22 if v, ok := PbToGoMapping[s]; ok { 23 return v 24 } 25 return s 26 } 27 28 func addOne(a int) int { 29 return a + 1 30 }