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

Updating the AddressBook

As we are going to work with the application we wrote in Chapter 7, let’s copy it over to the chapter9 directory:

$ cp -R ../chapter7/cmd/addressbook cmd
$ cp -R ../chapter7/pkg/addressbook pkg
$ cp ../chapter7/main.go .
$ cp ../chapter7/proto/addressbook.proto proto

Now, because we were using a Go module name including chapter7, we will need to replace all the occurrences by chapter9. On Linux/Mac, we can run the following command:

$ find . -type f -exec sh -c "sed -i '' -e 's/chapter7/chapter9/g' {}" ";"

And on Windows (Powershell), we can run the following:

$ Get-ChildItem -Recurse -File -Include *.proto,*.go,go.mod | ForEach { (Get-Content $_ | ForEach  { $_ -replace ‘chapter7’, ‘chapter9’ }) | Set-Content $_ }

We are now all set up to start.

The first step is to update our proto file to use our custom option. To do that, we will import our validate.proto...

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