grpc linux 环境搭建,Go开发环境搭建 - 蝴蝶谷的个人空间 - OSCHINA - 中文开源技术交流社区...

一、墙的问题

unrecognized import path "golang.org/x/sys/unix"

解决方法

mkdir $GOPATH/src/golang.org/x/ -p

cd $GOPATH/src/golang.org/x/

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

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

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

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

二、常用包安装

2.1 geoip、maxmind SDK

go get github.com/oschwald/geoip2-golang

2.2 服务发现——consul

go get github.com/hashicorp/consul

2.3 gRpc安装

2.3.1 windows 下安装:

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 github.com/golang/protobuf/protoc-gen-go

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

git clone https://github.com/google/go-genproto.git %GOPATH%/src/google.golang.org/genproto

cd %GOPATH%/src/

go install google.golang.org/grpc

2.3.2 linux 下安装:

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 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

2.4 kafka SDK(sarama)

go get -u github.com/Shopify/sarama

2.5 MongoDB SDK

go get -u github.com/jinzhu/gorm

go get -u gopkg.in/mgo.v2/bson

回答: 错误提示中提到了一个未知的标志"--go-grpc",这可能是因为你的命令中使用了错误的标志。正确的命令应该是"protoc --go-grpc_out=. --go-grpc_opt=paths=source_relative user.proto"。请注意,标志"--go-grpc_out"和"--go-grpc_opt"之间应该有一个下划线"_",而不是一个空格。另外,你还需要确保你已经安装了正确的go协议编译器插件。你可以使用以下命令重新安装插件:"$ go install google.golang.org/protobuf/cmd/protoc-gen-go@latest"和"$ go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest"。\[1\]\[2\]\[3\] #### 引用[.reference_title] - *1* *2* [使用protoc编译grpc问题记录(--go_out: protoc-gen-go: plugins are not supported;)](https://blog.csdn.net/m0_57777971/article/details/127864341)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [protoc-gen-go: plugin are not supported;use ‘protoc --go-grpc_out=...‘ to generate gRPC 的问题](https://blog.csdn.net/weixin_42875684/article/details/125652895)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值