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

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

查看所有标签

猜你喜欢:

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

Data Structures and Algorithms in Java

Data Structures and Algorithms in Java

Michael T. Goodrich、Roberto Tamassia / Wiley / 2010-01-26 / USD 177.41

* This newest edition examines fundamental data structures by following a consistent object-oriented framework that builds intuition and analysis skills of data structures and algorithms * Presents ne......一起来看看 《Data Structures and Algorithms in Java》 这本书的介绍吧!

随机密码生成器
随机密码生成器

多种字符组合密码

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

HTML 编码/解码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码