protoc-gen-go-grpc: program not found or is not executable

protoc-gen-go-grpc: program not found or is not executable

报错:
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.
Makefile:33: recipe for target ‘grpc’ failed

解决:
检查是否安装了protoc-gen-go-grpc,没安装先安装

1
go get -u github.com/golang/protobuf/protoc-gen-go

如果装了还是报错,由于默认是装在GOPATH/bin下的,但是编译好像找的路径是GOROOT,所以copy过去

1
cp protoc-gen-go  /usr/local/bin/

但是这么copy有点麻烦,不是长久之计
如果有更好的解决方法欢迎评论区留言