1
0
Эх сурвалжийг харах

fix the package name of grpc client (#1170)

* fix the package name of grpc client

* Remove k8s/utils

Co-authored-by: anqiansong <anqiansong@bytedance.com>
anqiansong 3 жил өмнө
parent
commit
bef5bd4e4f

+ 3 - 14
tools/goctl/rpc/generator/mkdir.go

@@ -8,7 +8,6 @@ import (
 	"github.com/tal-tech/go-zero/tools/goctl/rpc/parser"
 	"github.com/tal-tech/go-zero/tools/goctl/util"
 	"github.com/tal-tech/go-zero/tools/goctl/util/ctx"
-	"github.com/tal-tech/go-zero/tools/goctl/util/format"
 	"github.com/tal-tech/go-zero/tools/goctl/util/stringx"
 )
 
@@ -52,7 +51,7 @@ type (
 	}
 )
 
-func mkdir(ctx *ctx.ProjectContext, proto parser.Proto, cfg *conf.Config) (DirContext, error) {
+func mkdir(ctx *ctx.ProjectContext, proto parser.Proto, _ *conf.Config) (DirContext, error) {
 	inner := make(map[string]Dir)
 	etcDir := filepath.Join(ctx.WorkDir, "etc")
 	internalDir := filepath.Join(ctx.WorkDir, "internal")
@@ -61,19 +60,9 @@ func mkdir(ctx *ctx.ProjectContext, proto parser.Proto, cfg *conf.Config) (DirCo
 	serverDir := filepath.Join(internalDir, "server")
 	svcDir := filepath.Join(internalDir, "svc")
 	pbDir := filepath.Join(ctx.WorkDir, proto.GoPackage)
-	sName, err := format.FileNamingFormat(cfg.NamingFormat, proto.Service.Name)
-	if err != nil {
-		return nil, err
-	}
-
-	callDir := filepath.Join(ctx.WorkDir, sName)
+	callDir := filepath.Join(ctx.WorkDir, strings.ToLower(stringx.From(proto.Service.Name).ToCamel()))
 	if strings.EqualFold(proto.Service.Name, proto.GoPackage) {
-		clientDir, err := format.FileNamingFormat(cfg.NamingFormat, proto.Service.Name+"_client")
-		if err != nil {
-			return nil, err
-		}
-
-		callDir = filepath.Join(ctx.WorkDir, clientDir)
+		callDir = filepath.Join(ctx.WorkDir, strings.ToLower(stringx.From(proto.Service.Name+"_client").ToCamel()))
 	}
 
 	inner[wd] = Dir{