概述
go下载插件到bin目录下, 使用go env 可以查看
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
可以直接使用了,输出proto对应文件
# 格式: protoc --go_out 目标路径 文件路径
protoc --go_out ./ ./heart_beat.proto
如果发现提示:
File does not reside within any path specified using --proto_path (or -I). You must specify a --proto_path which encompasses this file. Note that the proto_path must be an exact prefix of the .proto file names – protoc is too dumb to figure out when two paths (e.g. absolute and relative) are equivalent (it’s harder than you think).
请这样使用:
先进入proto文件对应的文件夹
protoc [proto文件名] --go_out [生成的路径]
最后
以上就是自觉万宝路为你收集整理的go语言生成.proto生成go文件的全部内容,希望文章能够帮你解决go语言生成.proto生成go文件所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复