Search code examples
protocol-buffersprotoc

protoc not finding things in proto_path


I'm finding that protoc doesn't seem to find things which are on the proto_path despite them being present:

$ protoc --proto_path=protobufs/protobufs \
    --go_out=plugins=grpc:/home/me/go/src somefolder/enums.proto
somefolder/enums.proto: No such file or directory
$ ls protobufs/protobufs/somefolder/enums.proto 
protobufs/protobufs/somefolder/enums.proto

Why might this happen? It doesn't seem to happen to others. I'm using Ubuntu 18.04, and protoc --version says libprotoc 3.0.0.


Solution

  • Can you try this command?

    protoc --proto_path=protobufs/protobufs \
        --go_out=plugins=grpc:/home/me/go/src \
        protobufs/protobufs/somefolder/enums.proto 
    

    The proto_path argument is used to tell protoc where should it look for import proto files.