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

pull/828/head
Cluas 4 years ago committed by GitHub
parent 35d7b4113f
commit c086eb1147
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      cmd/kratos/internal/proto/add/add.go
  2. 2
      cmd/kratos/internal/proto/add/proto.go

@ -59,7 +59,7 @@ func javaPackage(name string) string {
} }
func serviceName(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) { if _, err := os.Stat(name); !os.IsNotExist(err) {
return fmt.Errorf("%s already exists", p.Name) return fmt.Errorf("%s already exists", p.Name)
} }
return ioutil.WriteFile(name, []byte(body), 0644) return ioutil.WriteFile(name, body, 0644)
} }

Loading…
Cancel
Save