windows 安装 GRPC go版本

栏目: 服务器 · 发布时间: 7年前

内容简介:下载把解压后的 bin 目录下的 protoc.exe 放入到 GOBIN (go env 查看) 中Git clone

1. 安装 protobuf

下载 protoc-3.5.1-win32.zip

把解压后的 bin 目录下的 protoc.exe 放入到 GOBIN (go env 查看) 中

2. 安装 grpc

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

将grpc-go文件夹重命名为grpc,放入到google.golang.org中,完整路径如下

C:\GOPATH\src\google.golang.org\grpc

3. 安装 genproto

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

将go-genproto文件夹重命名为genproto,放到google.golang.org下,完整路径如下

C:\GOPATH\src\google.golang.org\genproto

4. 安装 proto

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

5. 安装 protoc-gen-go

go get -u github.com/golang/protobuf/protoc-gen-go

6. 下载依赖包

创建目录 C:\GOPATH\src\golang.org\x

进入 x 目录

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

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

7. 使用

cd 到 src\google.golang.org\grpc\examples\helloworld目录

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

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

  • 进入 \src\google.golang.org\grpc\examples\helloworld\greeter_server 目录
    执行 go run main.go
  • 进入 \src\google.golang.org\grpc\examples\helloworld\greeter_client 目录
    执行 go run main.go yourname

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

How to Think About Algorithms

How to Think About Algorithms

Jeff Edmonds / Cambridge University Press / 2008-05-19 / USD 38.99

HOW TO THINK ABOUT ALGORITHMS There are many algorithm texts that provide lots of well-polished code and proofs of correctness. Instead, this one presents insights, notations, and analogies t......一起来看看 《How to Think About Algorithms》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具