Reader small image

You're reading from  Protocol Buffers Handbook

Product typeBook
Published inApr 2024
PublisherPackt
ISBN-139781805124672
Edition1st Edition
Right arrow
Author (1)
Clément Jean
Clément Jean
author image
Clément Jean

Clément Jean is the CTO of Education for Ethiopia, a start-up focusing on educating K-12 students in Ethiopia. On top of that, he is also an online instructor (on Udemy, Linux Foundation, and others) teaching people about diff erent kinds of technologies. In both his occupations, he deals with technologies such as Protobuf and gRPC and how to apply them to real-life use cases. His overall goal is to empower people through education and technology.
Read more about Clément Jean

Right arrow

Transpiling .proto files

We are finally ready to generate some code from the .proto file. And even though we are going to use the compiler for other tasks, this is the main one you will use protoc for. In this section, we will generate code in C++ and Go. This is not a random choice. One is a directly supported language for protoc, and the other is supported by adding/downloading a protoc plugin. By seeing how to generate code for these two languages, you should be able to generate code for any other language.

Why code generation?

Before even generating code, we need to understand what the point of generating code from a .proto file is. As of now, we mostly talked about Protobuf as an abstract concept being able to serialize and deserialize data. But, in later chapters, we will start using Protobuf serialization and deserialization in code.

To do so, instead of adding a dependency and calling exposed functions, Protobuf relies on generated code to manage all calls to the lower...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Protocol Buffers Handbook
Published in: Apr 2024Publisher: PacktISBN-13: 9781805124672

Author (1)

author image
Clément Jean

Clément Jean is the CTO of Education for Ethiopia, a start-up focusing on educating K-12 students in Ethiopia. On top of that, he is also an online instructor (on Udemy, Linux Foundation, and others) teaching people about diff erent kinds of technologies. In both his occupations, he deals with technologies such as Protobuf and gRPC and how to apply them to real-life use cases. His overall goal is to empower people through education and technology.
Read more about Clément Jean