From 73b61e09edd8157c9dbe0c9c637c0207fb5d85a3 Mon Sep 17 00:00:00 2001 From: kingxt Date: Wed, 26 Aug 2020 11:32:55 +0800 Subject: [PATCH] fix format (#23) * fir format * fix bug Co-authored-by: kingxt --- tools/goctl/api/gogen/genlogic.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/goctl/api/gogen/genlogic.go b/tools/goctl/api/gogen/genlogic.go index 2daff8ba..8182606d 100644 --- a/tools/goctl/api/gogen/genlogic.go +++ b/tools/goctl/api/gogen/genlogic.go @@ -29,7 +29,6 @@ func New{{.logic}}(ctx context.Context, svcCtx *svc.ServiceContext) {{.logic}} { ctx: ctx, Logger: logx.WithContext(ctx), } - // TODO need set model here from svc } func (l *{{.logic}}) {{.function}}({{.request}}) {{.responseType}} { @@ -98,7 +97,7 @@ func genLogicByRoute(dir string, group spec.Group, route spec.Route) error { "request": requestString, }) if err != nil { - return nil + return err } formatCode := formatCode(buffer.String()) _, err = fp.WriteString(formatCode) @@ -120,8 +119,7 @@ func getLogicFolderPath(group spec.Group, route spec.Route) string { func genLogicImports(route spec.Route, parentPkg string) string { var imports []string - imports = append(imports, `"context"`) - imports = append(imports, "\n") + imports = append(imports, `"context"`+"\n") imports = append(imports, fmt.Sprintf("\"%s/core/logx\"", vars.ProjectOpenSourceUrl)) if len(route.ResponseType.Name) > 0 || len(route.RequestType.Name) > 0 { imports = append(imports, fmt.Sprintf("\"%s\"", ctlutil.JoinPackages(parentPkg, typesDir)))