slimming/main.go
2022-08-23 17:58:07 +08:00

28 lines
542 B
Go

package slimming
import (
"flag"
"fmt"
"log"
"net"
gen "slimming/proto/gen"
"google.golang.org/grpc"
)
//go:generate bash -c "protoc --go_out=plugins=grpc:. proto/*.proto"
func main() {
flag.Parse()
lis, err := net.Listen("tcp", fmt.Sprintf(":%d", *serverPort))
if err != nil {
log.Fatalf("failed to listen: %v", err)
}
s := grpc.NewServer()
gen.RegisterFrameServiceServer(s, &RPCServer{})
log.Printf("server listening at %v", lis.Addr())
if err := s.Serve(lis); err != nil {
log.Fatalf("failed to serve: %v", err)
}
}