mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-14 18:30:02 +08:00
feat: support goctl --module to set go module (#5135)
This commit is contained in:
@@ -30,6 +30,8 @@ type ZRpcContext struct {
|
||||
Multiple bool
|
||||
// Whether to generate rpc client
|
||||
IsGenClient bool
|
||||
// Module is the custom module name for go.mod
|
||||
Module string
|
||||
}
|
||||
|
||||
// Generate generates a rpc service, through the proto file,
|
||||
@@ -51,7 +53,12 @@ func (g *Generator) Generate(zctx *ZRpcContext) error {
|
||||
return err
|
||||
}
|
||||
|
||||
projectCtx, err := ctx.Prepare(abs)
|
||||
var projectCtx *ctx.ProjectContext
|
||||
if len(zctx.Module) > 0 {
|
||||
projectCtx, err = ctx.PrepareWithModule(abs, zctx.Module)
|
||||
} else {
|
||||
projectCtx, err = ctx.Prepare(abs)
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user