grpc需要google.golang.org 放在$GOPAT的src下,在src建立golang.org放x文件夹。
服务端:
wilson@wilson-virtual-machine:~/go/src/google.golang.org/grpc/examples/helloworld$ cd greeter_server/
wilson@wilson-virtual-machine:~/go/src/google.golang.org/grpc/examples/helloworld/greeter_server$ ls
main.go
wilson@wilson-virtual-machine:~/go/src/google.golang.org/grpc/examples/helloworld/greeter_server$ go run main.go
客户端
wilson@wilson-virtual-machine:~/go/src/google.golang.org/grpc/examples/helloworld/greeter_client$ go run main.go
2018/12/19 21:31:30 Greeting: Hello world
wilson@wilson-virtual-machine:~/go/src/google.golang.org/grpc/examples/helloworld/greeter_client$
会返回Greeting:hello world
这说明grpc环境搭建好了。