<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't <a href="https://github.com/google/protobuf" rel="nofollow">https://github.com/google/protobuf</a>.</p>
<p>"proto" is the package for encoding/decoding .proto files . It's used by "protoc-gen-go" for code generation. "protoc" looks for a relevant generator plugin of the name "protoc-gen-xx" by the flag "--xx_out".</p>
<p>For e.g for Go:</p>
<p>protoc --go_out=plugins=grpc:. *.proto </p>
<p>where "--go_out" 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 "proto3". This parser only recognizes "proto2".<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'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's just not mentioned in the usage. The idea is to support any plugin with the "mylanguagename_out" flag.</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传