当前位置:网站首页>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边栏推荐
- 【COCI 2020/2021 Round #2 D】Magneti (DP)
- A magical no main method of code
- DP5340 domestic replacement for CM5340 stereo audio A/D converter chip
- Ali Ermian: How many cluster solutions does Redis have?I answered 4
- redis实现分布式锁的原理
- go : create database records using gorm
- 专访蚂蚁:这群技术排头兵,如何做好底层开发这件事?| 卓越技术团队访谈录
- Keil编译大小和存储说明
- Electron日常学习笔记
- 2020 数学建模之旅
猜你喜欢

云服务器零基础部署网站(保姆级教程)

SOFA Weekly|Meetup 广州站、本周 QA、本周 Contributor

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

Keil软件中map文件解析

Go uses the mencached cache

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

The first artificial intelligence safety competition officially launched

你好,我的新名字叫 “铜锁 / Tongsuo”

From catching up to surpassing, domestic software shows its talents

What are the access modifiers, declaration modifiers, and keywords in C#?Literacy articles
随机推荐
什么是微服务?
物联网网关该怎么选
bean的生命周期
go : use gorm to modify data
潜心打磨,主动求变——这群技术排头兵,如何做好底层开发这件事?
k8s 部署mysql8(PV和PVC 版本)
MySQL基础篇【命名规范】
Derivative Operations on Vectors and Derivative Operations on Vector Cross and Dot Products
服务器可靠性稳定性调优指引
Keil软件中map文件解析
IDEA搜索插件无结果一直转圈圈的解决办法
Go combines Gin to export Mysql data to Excel table
LSF提交作业命令--bsub
[硬核干货]由0到1,突破信息系统项目管理师(呕心沥血经验之谈)!!!
Monkey and Banana
mysql高阶语句(一)
Get all interface paths and names in the controller
Electron使用romote报错 : Uncaught TypeError: Cannot read property ‘BrowserWindow‘ of undefined
What new materials are used in the large aircraft C919?
mysql8的my.conf配置文件参考指引