mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-01-23 09:00:20 +08:00
fix: didn't use alias when importing logic package in handler.go when groups are using for api generation.
This commit is contained in:
parent
e0e3f97c7c
commit
6580b6a999
@ -91,10 +91,19 @@ func genHandlers(dir, rootPkg string, cfg *config.Config, api *spec.ApiSpec) err
|
||||
}
|
||||
|
||||
func genHandlerImports(group spec.Group, route spec.Route, parentPkg string) string {
|
||||
imports := []string{
|
||||
fmt.Sprintf("\"%s\"", pathx.JoinPackages(parentPkg, getLogicFolderPath(group, route))),
|
||||
fmt.Sprintf("\"%s\"", pathx.JoinPackages(parentPkg, contextDir)),
|
||||
var (
|
||||
imports []string
|
||||
logicAlias string
|
||||
)
|
||||
|
||||
_, exists := group.Annotation.Properties["group"]
|
||||
if exists {
|
||||
logicAlias = fmt.Sprintf("%s ", defaultLogicPackage)
|
||||
}
|
||||
imports = append(imports, fmt.Sprintf("%s\"%s\"", logicAlias,
|
||||
pathx.JoinPackages(parentPkg, getLogicFolderPath(group, route))))
|
||||
imports = append(imports, fmt.Sprintf("\"%s\"", pathx.JoinPackages(parentPkg, contextDir)))
|
||||
|
||||
if len(route.RequestTypeName()) > 0 {
|
||||
imports = append(imports, fmt.Sprintf("\"%s\"\n", pathx.JoinPackages(parentPkg, typesDir)))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user