chore: change interface{} to any (#2818)
* chore: change interface{} to any
* chore: update goctl version to 1.5.0
* chore: update goctl deps
This commit is contained in:
@@ -96,7 +96,7 @@ func (g *Generator) genCallGroup(ctx DirContext, proto parser.Proto, cfg *conf.C
|
||||
|
||||
aliasKeys := alias.KeysStr()
|
||||
sort.Strings(aliasKeys)
|
||||
if err = util.With("shared").GoFmt(true).Parse(text).SaveTo(map[string]interface{}{
|
||||
if err = util.With("shared").GoFmt(true).Parse(text).SaveTo(map[string]any{
|
||||
"name": callFilename,
|
||||
"alias": strings.Join(aliasKeys, pathx.NL),
|
||||
"head": head,
|
||||
@@ -159,7 +159,7 @@ func (g *Generator) genCallInCompatibility(ctx DirContext, proto parser.Proto,
|
||||
}
|
||||
aliasKeys := alias.KeysStr()
|
||||
sort.Strings(aliasKeys)
|
||||
return util.With("shared").GoFmt(true).Parse(text).SaveTo(map[string]interface{}{
|
||||
return util.With("shared").GoFmt(true).Parse(text).SaveTo(map[string]any{
|
||||
"name": callFilename,
|
||||
"alias": strings.Join(aliasKeys, pathx.NL),
|
||||
"head": head,
|
||||
@@ -211,7 +211,7 @@ func (g *Generator) genFunction(goPackage string, service parser.Service,
|
||||
streamServer = fmt.Sprintf("%s_%s%s", parser.CamelCase(service.Name),
|
||||
parser.CamelCase(rpc.Name), "Client")
|
||||
}
|
||||
buffer, err := util.With("sharedFn").Parse(text).Execute(map[string]interface{}{
|
||||
buffer, err := util.With("sharedFn").Parse(text).Execute(map[string]any{
|
||||
"serviceName": stringx.From(service.Name).ToCamel(),
|
||||
"rpcServiceName": parser.CamelCase(service.Name),
|
||||
"method": parser.CamelCase(rpc.Name),
|
||||
@@ -254,7 +254,7 @@ func (g *Generator) getInterfaceFuncs(goPackage string, service parser.Service,
|
||||
parser.CamelCase(rpc.Name), "Client")
|
||||
}
|
||||
buffer, err := util.With("interfaceFn").Parse(text).Execute(
|
||||
map[string]interface{}{
|
||||
map[string]any{
|
||||
"hasComment": len(comment) > 0,
|
||||
"comment": comment,
|
||||
"method": parser.CamelCase(rpc.Name),
|
||||
|
||||
@@ -33,7 +33,7 @@ func (g *Generator) GenEtc(ctx DirContext, _ parser.Proto, cfg *conf.Config) err
|
||||
return err
|
||||
}
|
||||
|
||||
return util.With("etc").Parse(text).SaveTo(map[string]interface{}{
|
||||
return util.With("etc").Parse(text).SaveTo(map[string]any{
|
||||
"serviceName": strings.ToLower(stringx.From(ctx.GetServiceName().Source()).ToCamel()),
|
||||
}, fileName, false)
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ func (g *Generator) genLogicInCompatibility(ctx DirContext, proto parser.Proto,
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = util.With("logic").GoFmt(true).Parse(text).SaveTo(map[string]interface{}{
|
||||
err = util.With("logic").GoFmt(true).Parse(text).SaveTo(map[string]any{
|
||||
"logicName": fmt.Sprintf("%sLogic", stringx.From(rpc.Name).ToCamel()),
|
||||
"functions": functions,
|
||||
"packageName": "logic",
|
||||
@@ -114,7 +114,7 @@ func (g *Generator) genLogicGroup(ctx DirContext, proto parser.Proto, cfg *conf.
|
||||
return err
|
||||
}
|
||||
|
||||
if err = util.With("logic").GoFmt(true).Parse(text).SaveTo(map[string]interface{}{
|
||||
if err = util.With("logic").GoFmt(true).Parse(text).SaveTo(map[string]any{
|
||||
"logicName": logicName,
|
||||
"functions": functions,
|
||||
"packageName": packageName,
|
||||
@@ -139,7 +139,7 @@ func (g *Generator) genLogicFunction(serviceName, goPackage, logicName string,
|
||||
comment := parser.GetComment(rpc.Doc())
|
||||
streamServer := fmt.Sprintf("%s.%s_%s%s", goPackage, parser.CamelCase(serviceName),
|
||||
parser.CamelCase(rpc.Name), "Server")
|
||||
buffer, err := util.With("fun").Parse(text).Execute(map[string]interface{}{
|
||||
buffer, err := util.With("fun").Parse(text).Execute(map[string]any{
|
||||
"logicName": logicName,
|
||||
"method": parser.CamelCase(rpc.Name),
|
||||
"hasReq": !rpc.StreamsRequest,
|
||||
|
||||
@@ -73,7 +73,7 @@ func (g *Generator) GenMain(ctx DirContext, proto parser.Proto, cfg *conf.Config
|
||||
return err
|
||||
}
|
||||
|
||||
return util.With("main").GoFmt(true).Parse(text).SaveTo(map[string]interface{}{
|
||||
return util.With("main").GoFmt(true).Parse(text).SaveTo(map[string]any{
|
||||
"serviceName": etcFileName,
|
||||
"imports": strings.Join(imports, pathx.NL),
|
||||
"pkg": proto.PbPackage,
|
||||
|
||||
@@ -89,7 +89,7 @@ func (g *Generator) genServerGroup(ctx DirContext, proto parser.Proto, cfg *conf
|
||||
}
|
||||
}
|
||||
|
||||
if err = util.With("server").GoFmt(true).Parse(text).SaveTo(map[string]interface{}{
|
||||
if err = util.With("server").GoFmt(true).Parse(text).SaveTo(map[string]any{
|
||||
"head": head,
|
||||
"unimplementedServer": fmt.Sprintf("%s.Unimplemented%sServer", proto.PbPackage,
|
||||
stringx.From(service.Name).ToCamel()),
|
||||
@@ -140,7 +140,7 @@ func (g *Generator) genServerInCompatibility(ctx DirContext, proto parser.Proto,
|
||||
}
|
||||
}
|
||||
|
||||
return util.With("server").GoFmt(true).Parse(text).SaveTo(map[string]interface{}{
|
||||
return util.With("server").GoFmt(true).Parse(text).SaveTo(map[string]any{
|
||||
"head": head,
|
||||
"unimplementedServer": fmt.Sprintf("%s.Unimplemented%sServer", proto.PbPackage,
|
||||
stringx.From(service.Name).ToCamel()),
|
||||
@@ -175,7 +175,7 @@ func (g *Generator) genFunctions(goPackage string, service parser.Service, multi
|
||||
comment := parser.GetComment(rpc.Doc())
|
||||
streamServer := fmt.Sprintf("%s.%s_%s%s", goPackage, parser.CamelCase(service.Name),
|
||||
parser.CamelCase(rpc.Name), "Server")
|
||||
buffer, err := util.With("func").Parse(text).Execute(map[string]interface{}{
|
||||
buffer, err := util.With("func").Parse(text).Execute(map[string]any{
|
||||
"server": stringx.From(service.Name).ToCamel(),
|
||||
"logicName": logicName,
|
||||
"method": parser.CamelCase(rpc.Name),
|
||||
|
||||
@@ -30,7 +30,7 @@ func (g *Generator) GenSvc(ctx DirContext, _ parser.Proto, cfg *conf.Config) err
|
||||
return err
|
||||
}
|
||||
|
||||
return util.With("svc").GoFmt(true).Parse(text).SaveTo(map[string]interface{}{
|
||||
return util.With("svc").GoFmt(true).Parse(text).SaveTo(map[string]any{
|
||||
"imports": fmt.Sprintf(`"%v"`, ctx.GetConfig().Package),
|
||||
}, fileName, false)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user