内容简介:来自这里官方安装命令:原因你懂的。
0. 先决必要条件:golang 1.9+,这里略过。
1. quick install
来自这里 https://github.com/grpc/homebrew-grpc
brew tap grpc/grpc brew install --with-plugins grpc
2. 从代码编译安装
2.1 protobuf install
brew install autoconf automake libtool curl make g++ unzip 下载[protobuf](https://github.com/protocolbuffers/protobuf/releases/latest) tar -zxvf protobuf-x.x.x cd protobuf-x.x.x ./configure --prefix=/usr make make check sudo make install protoc --version
-
以上是基于release版本变异安装的过程。如果直接git clone master分支,可能还需要先安装xcode,之后:
sudo xcode-select --install - 更详细步骤参考github项目 protobuf
2.2 grpc-go install
官方安装命令: go get google.golang.org/grpc
然而一般都会失败报错:
https fetch failed: Get https://google.golang.org/grpc?go-get=1: net/http: TLS handshake timeout
原因你懂的。
其实是这个代码已经转移到github上面了,但是代码里面的包依赖还是没有修改,还是google.golang.org这种,
所以:
git clone https://github.com/grpc/grpc-go.git $GOPATH/src/google.golang.org/grpc
git clone https://github.com/golang/net.git $GOPATH/src/golang.org/x/net
git clone https://github.com/golang/text.git $GOPATH/src/golang.org/x/text
go get -u -v github.com/golang/protobuf/{proto,protoc-gen-go}
git clone https://github.com/google/go-genproto.git $GOPATH/src/google.golang.org/genproto
cd $GOPATH/src/
go install google.golang.org/grpc
- 这一部分参考,实测可行: https://www.jianshu.com/p/dba4c7a6d608
3. 总结
至此,grpc-go mac 开发环境ready!后续将继续分享grpc使用笔记,下篇计划:
- grpc-go使用入门级示例。
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
鸟哥的Linux私房菜 基础学习篇(第二版)
鸟哥 / 人民邮电出版社 / 2007-9 / 65.00元
《鸟哥的Linux私房菜基础学习篇(第二版)》全面而详细地介绍了Linux操作系统。全书分为5个部分:第一部分着重说明Linux的起源及功能,如何规划和安装Linux主机;第二部分介绍Linux的文件系统、文件、目录与磁盘的管理;第三部分介绍文字模式接口shell和管理系统的好帮手shell脚本,另外还介绍了文字编辑器vi和vim的使用方法;第四部分介绍了对于系统安全非常重要的Linux账号的管理......一起来看看 《鸟哥的Linux私房菜 基础学习篇(第二版)》 这本书的介绍吧!