Reputation:
I'm trying to make golang+grpc server on mac. I installed golang, grpc, protocol buffer and checked that grpc server following this example https://grpc.io/docs/quickstart/go/ The problem is when I try to compile .proto file using protocol buffer it said 'missing input' or 'program is not executable'.
install protocol buffer and grpc
brew install grpc protobuf
install golang based protoc plugin
go get github.com/golang/protobuf/protoc-gen-go
protoc path
which protoc
/usr/local/bin/protoc
example location
/Users/usrname/go/src/google.golang.org/grpc/examples/helloworld
run proto compiler
protoc -I=/Users/username/go/src/google.golang.org/grpc/examples/helloworld/helloworld/ --go_out=/Users/username/go/src/google.golang.org/grpc/examples/helloworld/helloworld/ /Users/username/go/src/google.golang.org/grpc/examples/helloworld/helloworld/helloworld.proto
error message
protoc-gen-go: 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_out: protoc-gen-go: Plugin failed with status code 1.
Upvotes: 2
Views: 1721
Reputation: 1328262
This was mentioned in golang/protobuf
issue 795
See the
Installation
section of the pageREADME
:Grab the code from the repository and install the proto package.
The simplest way is to rungo get -u github.com/golang/protobuf/protoc-gen-go
.The compiler plugin,
protoc-gen-go
, will be installed in$GOPATH/bin
unless$GOBIN
is set. It must be in your$PATH
for the protocol compiler,protoc
, to find it.
So double-check the value of your $GOPATH
(~/go
by default if not set)
If $GOPATH/bin
(or ~/go/bin
) in your $PATH
?
The OP camilla confirms it is not:
$PATH
also has:/Users/username/go/bin/protoc-gen-go
It should have :/Users/username/go/bin
Upvotes: 0