From c086eb11475489bfd3053e6ccfff86f6d9eca03b Mon Sep 17 00:00:00 2001 From: Cluas Date: Tue, 13 Apr 2021 10:27:12 +0800 Subject: [PATCH] proto/add: rename to export && remove unnecessary type conversion (#825) --- cmd/kratos/internal/proto/add/add.go | 4 ++-- cmd/kratos/internal/proto/add/proto.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/kratos/internal/proto/add/add.go b/cmd/kratos/internal/proto/add/add.go index e8fa29f34..4caafe932 100644 --- a/cmd/kratos/internal/proto/add/add.go +++ b/cmd/kratos/internal/proto/add/add.go @@ -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:] } diff --git a/cmd/kratos/internal/proto/add/proto.go b/cmd/kratos/internal/proto/add/proto.go index dbc082eb0..e44b3c711 100644 --- a/cmd/kratos/internal/proto/add/proto.go +++ b/cmd/kratos/internal/proto/add/proto.go @@ -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) }