Comparison of proto file codes produced by Protoc and Protoc-gen-go

Source: Internet
Author: User
This is a created article in which the information may have evolved or changed.

Protoc command from Https://github.com/google/protobuf, because there is no go to generate code, go generated code in Protoc-gen-go (https://github.com/golang/ protobuf/) here.

$ Protoc--go_out=./go/./proto/helloworld.proto

$ Protoc--go_out=plugins=grpc:./go2/./proto/helloworld.proto

Above two commands, the first one produces only the code that protobuffer the file serialization and deserialization.

The second produces the common library code that the server and client communicate and implement, in addition to the first code.

Https://github.com/grpc/grpc-go the package name that corresponds to this code is:google.golang.org/grpc 这里只是一些公共函数库, protoc 和 protoc-gen-go 这两个工具都不在这里。

产生 protoc-gen-go 这个工具的方法如下:

$ go get-u github.com/golang/protobuf/protoc-gen-go

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.