background

Record a few pits using Proto as a GPRC interface, based on Goland IDE

import

When you write a proto, sometimes you need to import another proto, and then you will notice that the goland import path does not exist



Note that this is just a reminder of the Goland plugin. It has nothing to do with the actual generation. You just need to add the path of your proto to the plugin path



But in the actual generation of PB file, you only need to add the associated directory through -i in the command

protoc --go_out=plugins=grpc:. -I=${GOPATH}/src -I=. *.proto

google protobuf

Most of the time, I hope to quote Google mature proto, such as “Google/protobuf/empty. Proto”, then I go to dead simple search, search out of the garage also do have these proto, but mixed with many other documents, And the directory isn’t Google /protobuf/

This file is already in the package that you downloaded Protoc, but you didn’t notice it at the time. It’s in the include directory