Richard Rublev
Richard Rublev

Reputation: 8182

Compiling protocol buffers:Missing output directives

I tried to compile proto(Ubuntu 18.04)

protoc — go_out=. test.proto 
Missing output directives.

My env

go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/miki/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/miki/go"
GORACE=""
GOROOT="/usr"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/gcc/x86_64-linux-gnu/8"
GCCGO="/usr/bin/x86_64-linux-gnu-gccgo-8"
CC="x86_64-linux-gnu-gcc-8"
CXX="x86_64-linux-gnu-g++-8"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build089604877=/tmp/go-build -gno-record-gcc-switches -funwind-tables"

protoc-gen-go is in my bin

~/go/bin$ ls
gocode  gopkgs  goreturns  protoc-gen-go

I edited my bashrc

echo $PATH
/home/miki/go/bin

Strugle with the same thing again.

How to set ouput directives?

Upvotes: 3

Views: 14913

Answers (2)

Mohammad Reza Karimi
Mohammad Reza Karimi

Reputation: 2077

Write your command like this:

protoc --go_out=. test.proto 

If you need it for a gRPC server:

protoc --go-grpc_out=. test.proto 

for more details, I wanna tell you this part --go_out=. is related to

option go_package="/<folder_name>";

that you wrote in your .proto file and both are used to determine the output address.

Upvotes: 1

Nick Chapman
Nick Chapman

Reputation: 4634

It looks like your original command has a space between the -- and go_out=.?

Upvotes: 7

Related Questions