1笨奠、如何在window下,根據(jù)*.proto 生成代碼么脖隶?
image
2顾患、下載protoc
https://github.com/protocolbuffers/protobuf/releases/download/v3.12.3/protoc-3.12.3-win64.zip
解壓后,放到$GOPATH/bin目錄下即可
image
3用踩、如何生成protoc-gen-go-grpc 渠退?
目前在github上,還沒有提供release版本捶箱,需要自己根據(jù)源碼生成
https://www.grpc.io/docs/languages/go/quickstart/
git clone -b v1.30.0 https://github.com/grpc/grpc-go
cd cmd/protoc-gen-go-grpc
go install .
image
4智什、生成*.pb.go代碼
protoc --plugin=protoc-gen-go=$protoc-gen-go的路徑 --go_out . helloworld.proto
image
5、如何生成*_grpc.pb.go
protoc --plugin=protoc-gen-go=$protoc-gen-go的路徑 --go-grpc_out . --go_out . helloworld.proto
image