🐈
[Go] [gRPC] protoc-gen-go: program not found or is not executable
What
gRPCの学習で初っ端からエラー。
$ protoc --go_out=../gofile/ --go_opt=paths=source_relative --go-grpc_out=../gofile/ --go-grpc_opt=paths=source_relative dummy.proto
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.
エラー内容から、そもそもプログラムがないとか、実行できない、PATHに問題ありと書かれている気がするが、どれが原因かわからなかった。
解決
以下の記事を参考にしたところ解決。
参考になりました。ありがとうございます。
PATHが通っていない。
$ protoc-gen-go --version
bash: protoc-gen-go: command not found
$ export PATH="$PATH:$(go env GOPATH)/bin"
バージョン引数は通らんで、ってなったけど、この後冒頭のコマンドが通った。
$ protoc-gen-go --version
protoc-gen-go: unknown argument "--version" (this program should be run by protoc, not directly)
備考
公式の手順を見返してみたら、これが関係あったのかも?
Update your environment’s path variable to include the path to the protoc executable. For example:
$ export PATH="$PATH:$HOME/.local/bin"
Discussion