执行 protoc -I=. –go_out=paths=source_relative:gen/go trip.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.
解决方案:
1. 找到 protoc-gen-go 文件,执行以下命令,该文件通过 go get 装置时会装置在 $GOPATH/go/bin 目录下 cp protoc-gen-go /usr/local/bin/
2. 而后vim ~/.zshrc
, 新增上面这一行(貌似我发现这一步能够不要, 执行完第一步当前就能够编译了 …)export GOPATH=$HOME/go PATH=$PATH:$GOPATH/bin
之后 source ~/. zshrc
即可