gin proto文件生成go文件报错:--go_out: protoc-gen-go: Plugin failed with status code 1 解决方法

Jackey Golang 1,543 次浏览 , , 没有评论

执行命令: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 即可

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

Go