diff --git a/tools/goctl/rpc/generator/genmain.go b/tools/goctl/rpc/generator/genmain.go index 9a607641..0785708d 100644 --- a/tools/goctl/rpc/generator/genmain.go +++ b/tools/goctl/rpc/generator/genmain.go @@ -23,6 +23,8 @@ import ( "github.com/tal-tech/go-zero/core/conf" "github.com/tal-tech/go-zero/zrpc" "google.golang.org/grpc" + "github.com/tal-tech/go-zero/core/service" + "google.golang.org/grpc/reflection" ) var configFile = flag.String("f", "etc/{{.serviceName}}.yaml", "the config file") @@ -37,6 +39,13 @@ func main() { s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) { {{.pkg}}.Register{{.service}}Server(grpcServer, srv) + + switch c.Mode { + case service.DevMode,service.TestMode: + reflection.Register(grpcServer) + default: + } + }) defer s.Stop()