package main import ( "fmt" "gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_management/internal/server" "gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_management/internal/svc" "gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_management/ranking_management" "gitea.youtukeji.com.cn/youtu/youtu_grpc/pkg/config" "github.com/zeromicro/go-zero/core/service" "github.com/zeromicro/go-zero/zrpc" "google.golang.org/grpc" "google.golang.org/grpc/reflection" ) const ServiceName = "ranking_management" func main() { var c config.Config err := config.GetConfig(&c, ServiceName) if err != nil { panic(err) } c.RpcServerConf.Name = ServiceName + ".rpc" ctx := svc.NewServiceContext(c) s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) { ranking_management.RegisterRankingManagementServer(grpcServer, server.NewRankingManagementServer(ctx)) if c.Mode == service.DevMode || c.Mode == service.TestMode { reflection.Register(grpcServer) } }) defer s.Stop() fmt.Printf("Starting rpc server at %s...\n", c.RpcServerConf.ListenOn) s.Start() }