内容简介:最近在windows 下安装grpc,趁着现在放假整体记录一下下载过程。由于
最近在windows 下安装grpc,趁着现在放假整体记录一下下载过程。
一.安装protoc程序
protoc下载地址 ,打开链接,下载对应版本(我下载的是protoc-3.11.4-win64.zip),解压后将protoc.exe拷贝至放入到GOPATH/bin目录下。
二.安装grpc
由于 google.golang.org/grpc 已经迁移到 https://github.com/grpc/grpc-go ,所以我们需要另辟蹊径
- 在GOPATH/src 目录下创建google.golang.org 目录
- 切换到 GOPATH/src/google.golang.org 目录下,执行命令
git clone https://github.com/grpc/grpc-go grpc
- 下载genproto,在GOPATH/src/google.golang.org 目录下,执行命令
git clone https://github.com/google/go-genproto genproto
- 下载 text包,创建GOPATH/src/golang.org/x 目录,执行命令
git clone https://github.com/golang/text.git
- 下载 net包,在GOPATH/src/golang.org/x 目录,执行命令
git clone https://github.com/golang/net.git
- 有可能有加解密的需求,下载 crypto包,在GOPATH/src/golang.org/x 目录,执行命令
git clone https://github.com/golang/crypto.git
- 安装proto,执行命令
go get -u github.com/golang/protobuf/proto
- 安装grpc,切换到GOPATH/src 目录下,执行命令
go install google.golang.org/grpc
注释:
本人在 install时 报错:unrecognized import path "google.golang.org/protobuf/encoding/prototext" ,简单的说 google.golang.org/protobuf 没有,我也搞不懂为什么 需要在 google.golang.org 需要 protobuf,不过它让下载就下载吧!推荐在install之前运行下面命令!!
切换到GOPATH/src/google.golang.org 目录下,执行命令
git clone https://e.coding.net/robinqiwei/googleprotobuf.git protobuf
三.验证grpc安装成功
-
启动 Server
切换至GOPATH\google.golang.org\grpc\examples\helloworld\greeter_server,执行如下命令启动gRPC Server
go run main.go
-
启动 Client
切换至GOPATH\google.golang.org\grpc\examples\helloworld\greeter_client,执行如下命令启动gRPC Client
go run main.go
- 效果自行比对
本文到此结束,因为本人在找安装grpc的相关文章 并没有看到 要安装google.golang.org/protobuf 这个包,如果有小伙伴知道 为什么需要安装,恳请留言告知 :pray:
最后 祝大家五一:fish:快~~
欢迎关注我们的微信公众号,每天学习 Go 知识
以上所述就是小编给大家介绍的《windows 下载 grpc》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:- Android原生下载(下篇)多文件下载+多线程下载
- 小说下载器 ebookdownloader v1.7.5 发布:添加新下载源
- 前端培训-初级阶段-场景实战(2019-06-06)-下载文件&下载进度
- Windows 10 解决无法完整下载安装语言包(日语输入法无法下载使用)
- PHP 下载远程图片
- 爬虫下载文章 BeautifulSoup
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Web Security Testing Cookbook
Paco Hope、Ben Walther / O'Reilly Media / 2008-10-24 / USD 39.99
Among the tests you perform on web applications, security testing is perhaps the most important, yet it's often the most neglected. The recipes in the Web Security Testing Cookbook demonstrate how dev......一起来看看 《Web Security Testing Cookbook》 这本书的介绍吧!