zoukankan      html  css  js  c++  java
  • gRPC奇怪的编译命令protoc

    举个栗子:

    protoc -I helloworld/ helloworld/helloworld.proto --go_out=plugins=grpc:helloworld

    大神说得没错,读文档就算是全英文,读起来也比你读翻译得一般的中文文档好理解很多

    protoc:https://developers.google.com/protocol-buffers/docs/gotutorial

    grpc:https://grpc.io/

    最近在研究Go实现微服务,protoc与gRPC这里不作介绍,只说一点:这个命令怎么用

    首先,protoc是一个编译命令,把protoc把*.protoc文件编译成*.pb.go或者*.pb2.py等等。

    protoc -I helloworld/ helloworld/helloworld.proto --go_out=plugins=grpc:helloworld

    看一下这条命令,/helloworld 是你要提供的相对位置的相对起点,如果是当前所在目录,那就写 . (一个小数点),helloworld/helloworld.proto是你proto文件所在地,后面的 --go_out=plugins=grpc:helloworld是输出目录,如果要输出到helloworld下的hhh目录里,就写为

     protoc -I helloworld/  helloworld/helloworld.proto --go_out=plugins=grpc:helloworld/hhh

    如果proto文件在helloworld目录的mizi里,那么怎么写?

     protoc -I helloworld  helloworld/mizi/helloworld.proto --go_out=plugins=grpc:helloworld/hhh

    大家执行后回发现,它把mizi目录也带到hhh里,也就是把目录结构保留下来了,如果我想得到下面的结果呢?很简单,调一下相对起点就好!

    helloworld linge$  protoc -I helloworld/mizi  helloworld/mizi/helloworld.proto --go_out=plugins=grpc:helloworld/hhh
  • 相关阅读:
    greenplum 常用整理
    postgresql 常用整理
    数据源整理
    hive 以like方式建表(携带表结构)
    kudu 常用整理
    mysql常用整理
    Linux查看文件内容的常用方式(more,less,head,tail,cat)
    python2.7 安装docx错误
    python2.7 安装搜索引擎错误
    mysql数据库安装错误
  • 原文地址:https://www.cnblogs.com/ww01/p/10643455.html
Copyright © 2011-2022 走看看