mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-10 16:30:01 +08:00
chore: update go-zero version (#5093)
Signed-off-by: kevin <wanjunfeng@gmail.com>
This commit is contained in:
@@ -64,7 +64,7 @@ func (g *Generator) genCallGroup(ctx DirContext, proto parser.Proto, cfg *conf.C
|
||||
isCallPkgSameToGrpcPkg := childDir == ctx.GetProtoGo().Filename
|
||||
|
||||
serviceName := stringx.From(service.Name).ToCamel()
|
||||
alias := collection.NewSet()
|
||||
alias := collection.NewSet[string]()
|
||||
var hasSameNameBetweenMessageAndService bool
|
||||
for _, item := range proto.Message {
|
||||
msgName := getMessageName(*item.Message)
|
||||
@@ -72,7 +72,7 @@ func (g *Generator) genCallGroup(ctx DirContext, proto parser.Proto, cfg *conf.C
|
||||
hasSameNameBetweenMessageAndService = true
|
||||
}
|
||||
if !isCallPkgSameToPbPkg {
|
||||
alias.AddStr(fmt.Sprintf("%s = %s", parser.CamelCase(msgName),
|
||||
alias.Add(fmt.Sprintf("%s = %s", parser.CamelCase(msgName),
|
||||
fmt.Sprintf("%s.%s", proto.PbPackage, parser.CamelCase(msgName))))
|
||||
}
|
||||
}
|
||||
@@ -102,7 +102,7 @@ func (g *Generator) genCallGroup(ctx DirContext, proto parser.Proto, cfg *conf.C
|
||||
protoGoPackage = ""
|
||||
}
|
||||
|
||||
aliasKeys := alias.KeysStr()
|
||||
aliasKeys := alias.Keys()
|
||||
sort.Strings(aliasKeys)
|
||||
if err = util.With("shared").GoFmt(true).Parse(text).SaveTo(map[string]any{
|
||||
"name": callFilename,
|
||||
@@ -135,7 +135,7 @@ func (g *Generator) genCallInCompatibility(ctx DirContext, proto parser.Proto,
|
||||
}
|
||||
|
||||
serviceName := stringx.From(service.Name).ToCamel()
|
||||
alias := collection.NewSet()
|
||||
alias := collection.NewSet[string]()
|
||||
var hasSameNameBetweenMessageAndService bool
|
||||
for _, item := range proto.Message {
|
||||
msgName := getMessageName(*item.Message)
|
||||
@@ -143,7 +143,7 @@ func (g *Generator) genCallInCompatibility(ctx DirContext, proto parser.Proto,
|
||||
hasSameNameBetweenMessageAndService = true
|
||||
}
|
||||
if !isCallPkgSameToPbPkg {
|
||||
alias.AddStr(fmt.Sprintf("%s = %s", parser.CamelCase(msgName),
|
||||
alias.Add(fmt.Sprintf("%s = %s", parser.CamelCase(msgName),
|
||||
fmt.Sprintf("%s.%s", proto.PbPackage, parser.CamelCase(msgName))))
|
||||
}
|
||||
}
|
||||
@@ -174,7 +174,7 @@ func (g *Generator) genCallInCompatibility(ctx DirContext, proto parser.Proto,
|
||||
pbPackage = ""
|
||||
protoGoPackage = ""
|
||||
}
|
||||
aliasKeys := alias.KeysStr()
|
||||
aliasKeys := alias.Keys()
|
||||
sort.Strings(aliasKeys)
|
||||
return util.With("shared").GoFmt(true).Parse(text).SaveTo(map[string]any{
|
||||
"name": callFilename,
|
||||
|
||||
@@ -53,9 +53,9 @@ func (g *Generator) genLogicInCompatibility(ctx DirContext, proto parser.Proto,
|
||||
return err
|
||||
}
|
||||
|
||||
imports := collection.NewSet()
|
||||
imports.AddStr(fmt.Sprintf(`"%v"`, ctx.GetSvc().Package))
|
||||
imports.AddStr(fmt.Sprintf(`"%v"`, ctx.GetPb().Package))
|
||||
imports := collection.NewSet[string]()
|
||||
imports.Add(fmt.Sprintf(`"%v"`, ctx.GetSvc().Package))
|
||||
imports.Add(fmt.Sprintf(`"%v"`, ctx.GetPb().Package))
|
||||
text, err := pathx.LoadTemplate(category, logicTemplateFileFile, logicTemplate)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -64,7 +64,7 @@ func (g *Generator) genLogicInCompatibility(ctx DirContext, proto parser.Proto,
|
||||
"logicName": fmt.Sprintf("%sLogic", stringx.From(rpc.Name).ToCamel()),
|
||||
"functions": functions,
|
||||
"packageName": "logic",
|
||||
"imports": strings.Join(imports.KeysStr(), pathx.NL),
|
||||
"imports": strings.Join(imports.Keys(), pathx.NL),
|
||||
}, filename, false)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -106,9 +106,9 @@ func (g *Generator) genLogicGroup(ctx DirContext, proto parser.Proto, cfg *conf.
|
||||
return err
|
||||
}
|
||||
|
||||
imports := collection.NewSet()
|
||||
imports.AddStr(fmt.Sprintf(`"%v"`, ctx.GetSvc().Package))
|
||||
imports.AddStr(fmt.Sprintf(`"%v"`, ctx.GetPb().Package))
|
||||
imports := collection.NewSet[string]()
|
||||
imports.Add(fmt.Sprintf(`"%v"`, ctx.GetSvc().Package))
|
||||
imports.Add(fmt.Sprintf(`"%v"`, ctx.GetPb().Package))
|
||||
text, err := pathx.LoadTemplate(category, logicTemplateFileFile, logicTemplate)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -118,7 +118,7 @@ func (g *Generator) genLogicGroup(ctx DirContext, proto parser.Proto, cfg *conf.
|
||||
"logicName": logicName,
|
||||
"functions": functions,
|
||||
"packageName": packageName,
|
||||
"imports": strings.Join(imports.KeysStr(), pathx.NL),
|
||||
"imports": strings.Join(imports.Keys(), pathx.NL),
|
||||
}, filename, false); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -66,8 +66,8 @@ func (g *Generator) genServerGroup(ctx DirContext, proto parser.Proto, cfg *conf
|
||||
svcImport := fmt.Sprintf(`"%v"`, ctx.GetSvc().Package)
|
||||
pbImport := fmt.Sprintf(`"%v"`, ctx.GetPb().Package)
|
||||
|
||||
imports := collection.NewSet()
|
||||
imports.AddStr(logicImport, svcImport, pbImport)
|
||||
imports := collection.NewSet[string]()
|
||||
imports.Add(logicImport, svcImport, pbImport)
|
||||
|
||||
head := util.GetHead(proto.Name)
|
||||
|
||||
@@ -94,7 +94,7 @@ func (g *Generator) genServerGroup(ctx DirContext, proto parser.Proto, cfg *conf
|
||||
"unimplementedServer": fmt.Sprintf("%s.Unimplemented%sServer", proto.PbPackage,
|
||||
parser.CamelCase(service.Name)),
|
||||
"server": stringx.From(service.Name).ToCamel(),
|
||||
"imports": strings.Join(imports.KeysStr(), pathx.NL),
|
||||
"imports": strings.Join(imports.Keys(), pathx.NL),
|
||||
"funcs": strings.Join(funcList, pathx.NL),
|
||||
"notStream": notStream,
|
||||
}, serverFile, true); err != nil {
|
||||
@@ -111,8 +111,8 @@ func (g *Generator) genServerInCompatibility(ctx DirContext, proto parser.Proto,
|
||||
svcImport := fmt.Sprintf(`"%v"`, ctx.GetSvc().Package)
|
||||
pbImport := fmt.Sprintf(`"%v"`, ctx.GetPb().Package)
|
||||
|
||||
imports := collection.NewSet()
|
||||
imports.AddStr(logicImport, svcImport, pbImport)
|
||||
imports := collection.NewSet[string]()
|
||||
imports.Add(logicImport, svcImport, pbImport)
|
||||
|
||||
head := util.GetHead(proto.Name)
|
||||
service := proto.Service[0]
|
||||
@@ -145,7 +145,7 @@ func (g *Generator) genServerInCompatibility(ctx DirContext, proto parser.Proto,
|
||||
"unimplementedServer": fmt.Sprintf("%s.Unimplemented%sServer", proto.PbPackage,
|
||||
parser.CamelCase(service.Name)),
|
||||
"server": stringx.From(service.Name).ToCamel(),
|
||||
"imports": strings.Join(imports.KeysStr(), pathx.NL),
|
||||
"imports": strings.Join(imports.Keys(), pathx.NL),
|
||||
"funcs": strings.Join(funcList, pathx.NL),
|
||||
"notStream": notStream,
|
||||
}, serverFile, true)
|
||||
|
||||
Reference in New Issue
Block a user