Fix issues (#965)

master
anqiansong 3 years ago committed by GitHub
parent b71ac2042a
commit 3203f8e06b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -32,7 +32,7 @@ import (
) )
var ( var (
buildVersion = "1.1.11-beta" buildVersion = "1.1.11-beta-1"
commands = []cli.Command{ commands = []cli.Command{
{ {
Name: "upgrade", Name: "upgrade",

@ -85,6 +85,7 @@ var commonMysqlDataTypeMap2 = map[string]string{
"enum": "string", "enum": "string",
"set": "string", "set": "string",
"json": "string", "json": "string",
"jsonb": "string",
"blob": "string", "blob": "string",
"longblob": "string", "longblob": "string",
"mediumblob": "string", "mediumblob": "string",

@ -63,7 +63,7 @@ func (g *RPCGenerator) Generate(src, target string, protoImportPath []string, go
return err return err
} }
dirCtx, err := mkdir(projectCtx, proto) dirCtx, err := mkdir(projectCtx, proto,g.cfg)
if err != nil { if err != nil {
return err return err
} }

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

Loading…
Cancel
Save