編譯成 .exe後執行,不會有程式自己結束(exited with status 259)的問題。
但是只要跑VScode的debug mode一下下就會自己結束(exited with status 259)
註冊gRPC server的程式碼如下
func main() {
fmt.Println("starting gRPC server...")
lis, err := net.Listen("tcp", "localhost:50052")
if err != nil {
log.Fatalf("failed to listen: %v \n", err)
}
grpcServer := grpc.NewServer()
calculatorPB.RegisterCalculatorServiceServer(grpcServer, &Server{})
if err := grpcServer.Serve(lis); err != nil {
log.Fatalf("failed to serve: %v \n", err)
}
}
VScode的結束訊息
DAP server listening at: 127.0.0.1:56497
Type 'dlv help' for list of commands.
Process 36928 has exited with status 259
Detaching
dlv dap (58440) exited with code: 0
一直找不到原因
不知道有人遇過嗎