在Windows中安装grpc - Go语言中文社区

在Windows中安装grpc


1、安装Protobuf

在  https://github.com/google/protobuf/releases

下载

protoc-3.5.1-win32.zip

把解压后的 protoc.exe 放入到 GOPATHBIN 中

2、安装grpc

Git clone https://github.com/grpc/grpc-go

将grpc-go更名为grpc放入到google.golang.org中,完整路径如下

D:gopathsrcgoogle.golang.orggrpc

3、安装Genproto

Git clone  https://github.com/google/go-genproto

将clone下来的文件夹更名为genproto,放到google.golang.org下,完整路径如下

D:gopathsrcgoogle.golang.orggenproto

4、下载text包

git clone https://github.com/golang/text.git

5、下载net包

git clone https://github.com/golang/net.git

6、安装proto

go get -u github.com/golang/protobuf/proto

7、安装protoc-gen-go

go get -ugithub.com/golang/protobuf/protoc-gen-go

8、验证

进入下列目录

srcgoogle.golang.orggrpcexampleshelloworld>

执行命令生成代码helloworld.pb.go

protoc -I ./helloworld--go_out=plugins=grpc:./helloworld ./helloworldhelloworld.proto

进入greeter_server下执行

go run main.go

进入greeter_client下执行

go run main.go

2018/06/19 11:29:25 Greeting: Hello world

Process finished with exit code 0

版权声明:本文来源简书,感谢博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://www.jianshu.com/p/8c3148f2885a
站方申明:本站部分内容来自社区用户分享,若涉及侵权,请联系站方删除。
  • 发表于 2020-02-02 14:52:55
  • 阅读 ( 1868 )
  • 分类:

0 条评论

请先 登录 后评论

官方社群

GO教程

猜你喜欢