当前位置:网站首页>golang grpc protoc 环境配置
golang grpc protoc 环境配置
2022-07-30 06:28:00 【慕菲烟云】
目录
本文以windows 64位 为例子,linux和mac方法基本一样
本文以windows 64位 为例子,linux和mac方法基本相同
protoc安装(protocbuf协议)
1:下载地址
Releases · protocolbuffers/protobuf · GitHub

2:解压,然后配置环境变量
在Path后面新增解压后的文件的bin目录,本文目录D:\protobuffer\bin

3:检查是否安装成功

protoc-gen-go安装
1:安装命令
go get -u github.com/golang/protobuf/protoc-gen-go
发现会安装失败的,(linux和mac安装可以参考一下方案)别急!有其他办法
2:方案二
2.1:使用go env 查看go的环境配置找到下面两个参数
GOROOT=C:\Program Files\Go
GOPATH=D:\goProjects

2.2:到GOPATH的src/github.com/golang 目录下
如果没有该目录自行创建目录 本文在:D:\goProjects\src\github.com\golang 目录下
2.3:git 拉取github.com/golang/protobuf代码
git clone https://github.com/golang/protobuf然后进入到\protobuf目录可以看到以下文件和目录

2.4:编译protoc-gen-go
进入到 protoc-gen-go目录
go install 然后回到GOPATH的bin目录下可以看到以下文件

2.5:复制protoc-gen-go.exe文件到GOROOT的bin目录下
至此protoc-gen-go安装完成
grpc安装
go get -u google.golang.org/grpc
安装失败,转手动安装
git clone https://github.com/grpc/grpc-go.git $env:GOPATH\src\google.golang.org\grpc
git clone https://github.com/golang/net.git $env:GOPATH\src\golang.org\x\net
git clone https://github.com/golang/text.git $env:GOPATH\src\golang.org\x\text
git clone https://github.com/google/go-genproto.git $env:GOPATH\src\google.golang.org\genproto边栏推荐
- DP5340国产替代CM5340立体声音频A/D转换器芯片
- BGP:边界网关路由协议 无类别的路径矢量EGP协议
- The first artificial intelligence safety competition officially launched
- Keil编译大小和存储说明
- golang : Zap日志整合
- MYSQL 主从恢复锁表后, 处理SQL 线程锁解决.
- go : go-redis list操作
- Playing script killing with AI: actually more involved than me
- this与super
- Universal js time date format conversion
猜你喜欢

How to calculate the daily cumulative capital flow one by one in real time

Limit injection record of mysql injection in No. 5 dark area shooting range

C# uses RestSharp to implement Get, Post requests (2)

Go uses freecache for caching

Mybitatis related configuration files

MySql详解基础

golang : Zap log integration

入选“十大硬核科技”,详解可信密态计算(TECC)技术点

Basic usage of tree arrays

mysql高阶语句(一)
随机推荐
【防作弊】Unity防本地调时间作弊
学生成绩管理系统(C语言)
golang: Gorm configures Mysql multiple data sources
分布式锁开发
2020 数学建模之旅
interface
golang: Gorm配置Mysql多数据源
uniapp中canvas与v-if更“配”
go : 使用gorm查询记录
树状数组的基本用法
goto语句
redis实现分布式锁的原理
go : go gin返回JSON数据
【day5】数组
redis常用指令
taro package compilation error
taro 打包编译报错
DP5340国产替代CM5340立体声音频A/D转换器芯片
MySQL基础篇【命名规范】
C language custom types, rounding