feat: Remove command `goctl rpc proto` (#1665)
* Fix goctl completion expression * Fix code generation error if the pkg of pb/grpc is same to zrpc call client pkg * Remove deprecated comment on action goctl rpc new * Remove zrpc code generation on action goctl rpc proto * Remove zrpc code generation on action goctl rpc proto * Remove Generator interface Co-authored-by: anqiansong <anqiansong@bytedance.com>master
parent
448029aa4b
commit
227104d7d7
@ -1,28 +0,0 @@
|
||||
package generator
|
||||
|
||||
import (
|
||||
"github.com/zeromicro/go-zero/tools/goctl/env"
|
||||
"github.com/zeromicro/go-zero/tools/goctl/util/console"
|
||||
)
|
||||
|
||||
// DefaultGenerator defines the environment needs of rpc service generation
|
||||
type DefaultGenerator struct {
|
||||
log console.Console
|
||||
}
|
||||
|
||||
// just test interface implement
|
||||
var _ Generator = (*DefaultGenerator)(nil)
|
||||
|
||||
// NewDefaultGenerator returns an instance of DefaultGenerator
|
||||
func NewDefaultGenerator() Generator {
|
||||
log := console.NewColorConsole()
|
||||
return &DefaultGenerator{
|
||||
log: log,
|
||||
}
|
||||
}
|
||||
|
||||
// Prepare provides environment detection generated by rpc service,
|
||||
// including go environment, protoc, whether protoc-gen-go is installed or not
|
||||
func (g *DefaultGenerator) Prepare() error {
|
||||
return env.Prepare(true, true)
|
||||
}
|
@ -1,19 +1,34 @@
|
||||
package generator
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
conf "github.com/zeromicro/go-zero/tools/goctl/config"
|
||||
"github.com/zeromicro/go-zero/tools/goctl/rpc/parser"
|
||||
"github.com/zeromicro/go-zero/tools/goctl/env"
|
||||
"github.com/zeromicro/go-zero/tools/goctl/util/console"
|
||||
)
|
||||
|
||||
// Generator defines a generator interface to describe how to generate rpc service
|
||||
type Generator interface {
|
||||
Prepare() error
|
||||
GenMain(ctx DirContext, proto parser.Proto, cfg *conf.Config) error
|
||||
GenCall(ctx DirContext, proto parser.Proto, cfg *conf.Config) error
|
||||
GenEtc(ctx DirContext, proto parser.Proto, cfg *conf.Config) error
|
||||
GenConfig(ctx DirContext, proto parser.Proto, cfg *conf.Config) error
|
||||
GenLogic(ctx DirContext, proto parser.Proto, cfg *conf.Config) error
|
||||
GenServer(ctx DirContext, proto parser.Proto, cfg *conf.Config) error
|
||||
GenSvc(ctx DirContext, proto parser.Proto, cfg *conf.Config) error
|
||||
GenPb(ctx DirContext, protoImportPath []string, proto parser.Proto, cfg *conf.Config, c *ZRpcContext, goOptions ...string) error
|
||||
// Generator defines the environment needs of rpc service generation
|
||||
type Generator struct {
|
||||
log console.Console
|
||||
cfg *conf.Config
|
||||
}
|
||||
|
||||
// NewGenerator returns an instance of Generator
|
||||
func NewGenerator(style string) *Generator {
|
||||
cfg, err := conf.NewConfig(style)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
log := console.NewColorConsole()
|
||||
return &Generator{
|
||||
log: log,
|
||||
cfg: cfg,
|
||||
}
|
||||
}
|
||||
|
||||
// Prepare provides environment detection generated by rpc service,
|
||||
// including go environment, protoc, whether protoc-gen-go is installed or not
|
||||
func (g *Generator) Prepare() error {
|
||||
return env.Prepare(true, true)
|
||||
}
|
||||
|
Loading…
Reference in New Issue