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
  • 相关阅读:
    0111. Minimum Depth of Binary Tree (E)
    0735. Asteroid Collision (M)
    0133. Clone Graph (M)
    1007. Minimum Domino Rotations For Equal Row (M)
    2018-8-10-win10-uwp-关联文件
    2018-2-13-win10-uwp-手动锁Bitlocker
    2018-2-13-win10-uwp-切换主题
    jquery开关灯
    jquery隔行变色
    jquery体验
  • 原文地址:https://www.cnblogs.com/ww01/p/10643455.html
Copyright © 2011-2022 走看看