执行命令:protoc --go_out=. param.proto 时,生成go文件报错,完整报错信息如下:
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.
解决方案:
依次执行
go get -u github.com/golang/protobuf/{proto,protoc-gen-go}
echo 'export GOPATH=$HOME/Go' >> $HOME/.bash_profile
source $HOME/.bash_profile
echo 'export PATH=$PATH:$GOPATH/bin' >> $HOME/.bash_profile
source $HOME/.bash_profile
然后再次执行:protoc --go_out=. param.proto 即可