1

I am trying to generate Go source code from .proto file through this command:

protoc greet/greetpb/greet.proto --go-grpc_out=plugins=grpc:. 

and, this is the directory structure:

greet/greetpb/greet.proto 

I have tried all the answers mentioned here But, none of them seems to be working.

I have verified that protoc-gen-go is in PATH. Still, I am getting this:

protoc-gen-go-grpc: program not found or is not executable Please specify a program using absolute path or make sure the program is available in your PATH system variable --go-grpc_out: protoc-gen-go-grpc: Plugin failed with status code 1. 

Additional details:

Go Version: go version go1.14.6 darwin/amd64 protoc version: libprotoc 3.12.3 

My .zshrc file:

export GOROOT=/usr/local/go export GOPATH=$HOME/go export GOBIN=$GOPATH/bin export PATH=$PATH:$GOROOT:$GOPATH:$GOBIN 
6
  • Try to add the option -I=. -I=$GOPATH/src. -I Specify the directory in which to search for imports. Commented Aug 3, 2020 at 7:34
  • I tried this protoc -I=. -I=absolute/path/to/dir/containting/proto/ greet/greetpb/greet.proto --go-grpc_out=plugins=grpc:., still getting the same error @Зелёный What are imports here? Commented Aug 3, 2020 at 7:41
  • 2
    You can try this command go install google.golang.org/grpc/cmd/protoc-gen-go-grpc and set --go-grpc_out=. Commented Aug 3, 2020 at 7:45
  • _/\_ this worked! Would you mind explaining the difference between the two commands? Commented Aug 3, 2020 at 7:47
  • To be honest I dont know, the out suffix looks like an option for the output path in this case the current directory .. Commented Aug 3, 2020 at 7:51

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.