go get google.golang.org/grpc

go get -u github.com/golang/protobuf/{proto,protoc-gen-go}

[root@localhost helloworld]# echo $GOPATH
/usr/local/go/workspacego

cd /usr/local/go/workspacego/src/google.golang.org/grpc/examples/helloworld/helloworld

[root@localhost helloworld]# cat /data/wwwroot/grpcdemo/client.go

  [root@localhost helloworld]# cat /data/wwwroot/grpcdemo/server.go

  

#go run /data/wwwroot/grpcdemo/server.go

另外发起一个终端

#go run /data/wwwroot/grpcdemo/client.go

服务端返回

2020/05/12 17:33:56 Received: world

客户端返回

2020/05/12 17:33:56 Greeting: Hello world