go怎么根据proto编译出bp文件
安装protobuf在前提条件中,需要安装libtool
sudo yum install libtool
然后安装过程中需要c++11,需要升级gcc的版本到4.7以上
以下目录下已预集成不同gcc的版本cd /opt/compiler/export PATH=/opt/compiler/gcc-8.2/bin:$PATHexport LIBRARY_PATH=/opt/compiler/gcc-8.2/lib64/:$LIBRARY_PATH
然后遇到问题:
protoc-gen-go: program not found or is not executable--go_out: protoc-gen-go: Plugin failed with status code 1.gen.go:10: running "protoc": exit status 1
解决方案:
https://blog.csdn.net/qq_38639426/article/details/107669849
然后编译proto的文件:
package pack// To run these commands, make sure that protoc-gen-go and protoc-gen-go-grpc are installed// > go install google.golang.org/protobuf/cmd/protoc-gen-go// > go install google.golang.org/grpc/cmd/protoc-gen-go-grpc//// Generated files were last generated with:// - protoc-gen-go: v1.27.1// - protoc-gen-go-grpc: v1.1.0//go:generate protoc --go_out=proto所在目录/ --go-grpc_out=proto所在目录/ proto所在目录/proto_test.proto
编译方式:
go generate ./...
页:
[1]