Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

README.md 1.3 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. gRPC in 3 minutes (Go)
  2. ======================
  3. BACKGROUND
  4. -------------
  5. For this sample, we've already generated the server and client stubs from [helloworld.proto](helloworld/helloworld/helloworld.proto).
  6. PREREQUISITES
  7. -------------
  8. - This requires Go 1.6 or later
  9. - Requires that [GOPATH is set](https://golang.org/doc/code.html#GOPATH)
  10. ```
  11. $ go help gopath
  12. $ # ensure the PATH contains $GOPATH/bin
  13. $ export PATH=$PATH:$GOPATH/bin
  14. ```
  15. INSTALL
  16. -------
  17. ```
  18. $ go get -u google.golang.org/grpc/examples/helloworld/greeter_client
  19. $ go get -u google.golang.org/grpc/examples/helloworld/greeter_server
  20. ```
  21. TRY IT!
  22. -------
  23. - Run the server
  24. ```
  25. $ greeter_server &
  26. ```
  27. - Run the client
  28. ```
  29. $ greeter_client
  30. ```
  31. OPTIONAL - Rebuilding the generated code
  32. ----------------------------------------
  33. 1. Install [protobuf compiler](https://github.com/google/protobuf/blob/master/README.md#protocol-compiler-installation)
  34. 1. Install the protoc Go plugin
  35. ```
  36. $ go get -u github.com/golang/protobuf/protoc-gen-go
  37. ```
  38. 1. Rebuild the generated Go code
  39. ```
  40. $ go generate google.golang.org/grpc/examples/helloworld/...
  41. ```
  42. Or run `protoc` command (with the grpc plugin)
  43. ```
  44. $ protoc -I helloworld/ helloworld/helloworld.proto --go_out=plugins=grpc:helloworld
  45. ```