3

golang安装gRpc

 1 year ago
source link: https://xinjiayu.github.io/post/golang%E5%AE%89%E8%A3%85grpc/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

golang安装gRpc

Sat, Mar 2, 2019

golang安装gRpc 安装官方安装命令:

go get google.golang.org/grpc

有的时候会报:

package google.golang.org/grpc: unrecognized import path "google.golang.org/grpc"(https fetch: Get https://google.golang.org/grpc?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)

原因是这个代码已经转移到github上面了,但是代码里面的包依赖还是没有修改,还是google.golang.org这种, 所以不能使用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/{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


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK