1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-03-19 21:18:07 +02:00

proto/add: rename to export && remove unnecessary type conversion ()

This commit is contained in:
Cluas 2021-04-13 10:27:12 +08:00 committed by GitHub
parent 35d7b4113f
commit c086eb1147
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions
cmd/kratos/internal/proto/add

@ -59,7 +59,7 @@ func javaPackage(name string) string {
}
func serviceName(name string) string {
return unexport(strings.Split(name, ".")[0])
return export(strings.Split(name, ".")[0])
}
func unexport(s string) string { return strings.ToUpper(s[:1]) + s[1:] }
func export(s string) string { return strings.ToUpper(s[:1]) + s[1:] }

@ -37,5 +37,5 @@ func (p *Proto) Generate() error {
if _, err := os.Stat(name); !os.IsNotExist(err) {
return fmt.Errorf("%s already exists", p.Name)
}
return ioutil.WriteFile(name, []byte(body), 0644)
return ioutil.WriteFile(name, body, 0644)
}