一、安装

官方安装命令: go get -u google.golang.org/grpc

由于google无法访问,虽然github上有grpc的代码,但是包依赖没有修改,所以不能go get安装,需要手动安装。

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

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

cd $GOPATH/src/

go install google.golang.org/grpc

$GOPATH替换为环境变量的实际路径。

 

二、编译.proto文件

protoc --go_out=plugins=grpc:. x.proto

相关文章:

  • 2022-12-23
  • 2021-12-02
  • 2022-01-20
  • 2022-12-23
  • 2021-09-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-15
  • 2022-12-23
  • 2021-07-26
  • 2020-04-22
  • 2022-12-23
  • 2022-02-26
  • 2022-12-23
相关资源
相似解决方案