Feat update rootpkg (#2718)

* add go-grpc_opt and go_opt for grpc new command

* feat: remove log when disable log

* feat: remove repeat code

Co-authored-by: zhouyy <zhouyy@ickey.cn>
master
chowyu12 2 years ago committed by GitHub
parent 251c071418
commit c4f8eca459
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -8,7 +8,6 @@ import (
"github.com/zeromicro/go-zero/tools/goctl/api/spec" "github.com/zeromicro/go-zero/tools/goctl/api/spec"
"github.com/zeromicro/go-zero/tools/goctl/config" "github.com/zeromicro/go-zero/tools/goctl/config"
"github.com/zeromicro/go-zero/tools/goctl/pkg/golang"
"github.com/zeromicro/go-zero/tools/goctl/util" "github.com/zeromicro/go-zero/tools/goctl/util"
"github.com/zeromicro/go-zero/tools/goctl/util/format" "github.com/zeromicro/go-zero/tools/goctl/util/format"
"github.com/zeromicro/go-zero/tools/goctl/util/pathx" "github.com/zeromicro/go-zero/tools/goctl/util/pathx"
@ -41,14 +40,10 @@ func genHandler(dir, rootPkg string, cfg *config.Config, group spec.Group, route
handler = strings.Title(handler) handler = strings.Title(handler)
logicName = pkgName logicName = pkgName
} }
parentPkg, err := golang.GetParentPackage(dir)
if err != nil {
return err
}
return doGenToFile(dir, handler, cfg, group, route, handlerInfo{ return doGenToFile(dir, handler, cfg, group, route, handlerInfo{
PkgName: pkgName, PkgName: pkgName,
ImportPackages: genHandlerImports(group, route, parentPkg), ImportPackages: genHandlerImports(group, route, rootPkg),
HandlerName: handler, HandlerName: handler,
RequestType: util.Title(route.RequestTypeName()), RequestType: util.Title(route.RequestTypeName()),
LogicName: logicName, LogicName: logicName,

Loading…
Cancel
Save