go-zero
go-zero copied to clipboard
fix: didn't use alias when importing logic package in handler.go when groups are using for api generation.
Thanks for your contribution, I checked the code generation of api again, it's unnecessary add an alias for group folder, for instance, there has an api file which contains part of content as following:
@server (
group: test
)
service greet-api {
@handler GreetHandler
get /from/:name(Request) returns (Response)
}
the generated results' tree showing as following:
.
├── etc
│ └── greet-api.yaml
├── greet.api
├── greet.go
└── internal
├── config
│ └── config.go
├── handler
│ ├── routes.go
│ └── test
│ └── greethandler.go
├── logic
│ └── test
│ └── greetlogic.go
├── svc
│ └── servicecontext.go
└── types
└── types.go
the handler's imports are
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"go-zero-demo/greet/internal/logic/test"
"go-zero-demo/greet/internal/svc"
"go-zero-demo/greet/internal/types"
)
it works correctly. As your pr do, the imports should be
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
**logic** "go-zero-demo/greet/internal/logic/test"
"go-zero-demo/greet/internal/svc"
"go-zero-demo/greet/internal/types"
)
it's not a recommend solution.