无法生成proto文件
当我尝试使用 Makefile 命令生成原型文件时 - protoc --proto_path=proto proto/*.proto --go_out=gen/
,我收到此错误 -
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
当我运行 which go
时,出现以下错误:
/usr/local/go/bin/go
which protoc
返回此 -
/usr/local/bin/protoc
这是我的 .zshrc
的样子:
export PATH="$PATH:/usr/local/mongodb/bin"
export GOROOT=/usr/local/go
我还安装了插件
$ go install google.golang.org/protobuf/cmd/[email protected]
$ go install google.golang.org/grpc/cmd/[email protected]
,否则我应该添加我的 .zshrc
以避免此错误?
When I try to generate a proto file using my Makefile command -protoc --proto_path=proto proto/*.proto --go_out=gen/
, I get this error -
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
When I run which go
, I have this:
/usr/local/go/bin/go
which protoc
returns this -
/usr/local/bin/protoc
Here is how my .zshrc
looks like:
export PATH="$PATH:/usr/local/mongodb/bin"
export GOROOT=/usr/local/go
I have also installed the plugins
$ go install google.golang.org/protobuf/cmd/[email protected]
$ go install google.golang.org/grpc/cmd/[email protected]
Please else should I add my .zshrc
to avoid this error?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议你使用 buf 替换 protoc,buf 更稳定且易于使用,不会出现奇怪的问题。
I suggest you use buf replace protoc, buf is more stable and easy to use without odd issues.