Why protobuf 3 not for golang

agolangf · · 1705 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Hi all,<br/> Why is protobuf version 3 is not available for golang yet? But for Java, Python etc. it is available. What is the reason? </p> <p>Thanks</p> <hr/>**评论:**<br/><br/>FEiN: <pre><p>It is? <a href="https://developers.google.com/protocol-buffers/docs/proto3#generating" rel="nofollow">https://developers.google.com/protocol-buffers/docs/proto3#generating</a></p></pre>zero_coding: <pre><p>First of all, thanks you very for the link. I tried to install protobuf with command<br/> <code>go get -u github.com/golang/protobuf/{proto,protoc-gen-go}</code><br/> and in my $GOPATH/bin folder I can find only the protoc-gen-go file not proto.<br/> What am I doing wrong?</p></pre>littlelakebigboat: <pre><p>You need to install protoc if you haven&#39;t <a href="https://github.com/google/protobuf" rel="nofollow">https://github.com/google/protobuf</a>.</p> <p>&#34;proto&#34; is the package for encoding/decoding .proto files . It&#39;s used by &#34;protoc-gen-go&#34; for code generation. &#34;protoc&#34; looks for a relevant generator plugin of the name &#34;protoc-gen-xx&#34; by the flag &#34;--xx_out&#34;.</p> <p>For e.g for Go:</p> <p>protoc --go_out=plugins=grpc:. *.proto </p> <p>where &#34;--go_out&#34; indicates protobuf-gen-go and grpc refers to code generation for grpc service definitions :</p> <p><a href="https://github.com/grpc/grpc-go" rel="nofollow">https://github.com/grpc/grpc-go</a>.</p></pre>zero_coding: <pre><p>I downloaded protobuf, install it and follow the tutorials on grpc website. When I want to generate proto.go file it shows me:<br/> helloworld.proto:30:10: Unrecognized syntax identifier &#34;proto3&#34;. This parser only recognizes &#34;proto2&#34;.<br/> What am I doing wrong? </p></pre>littlelakebigboat: <pre><p>Ensure :</p> <p>$ protoc --version</p> <p>libprotoc 3.0.0</p></pre>zero_coding: <pre><p>I typed and it shows me<br/> protoc --version<br/> libprotoc 2.6.1 </p> <p>Where can I download version 3?<br/> When I look at website, I can&#39;t find protobuf version 3 for golang <a href="https://github.com/google/protobuf/releases" rel="nofollow">https://github.com/google/protobuf/releases</a>.</p></pre>littlelakebigboat: <pre><p>I think you need to download(or git clone) the latest source release: <a href="https://github.com/google/protobuf/archive/v3.0.0-beta-1.tar.gz" rel="nofollow">https://github.com/google/protobuf/archive/v3.0.0-beta-1.tar.gz</a> and build it. The instructions are on the github readme.</p></pre>zero_coding: <pre><p>but the version does not support golang!! Only these languages: C++/Java/Python/Ruby/Nano/Objective-C/C#.</p></pre>littlelakebigboat: <pre><p>It does. It&#39;s just not mentioned in the usage. The idea is to support any plugin with the &#34;mylanguagename_out&#34; flag.</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

1705 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传