SETUP 896 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/sh
  2. echo "0. Ensure that protoc is installed."
  3. if which protoc; then
  4. echo "OK"
  5. else
  6. echo "Please install protoc and be sure that it is in your search path."
  7. exit
  8. fi
  9. echo "1. Set gopath and search path"
  10. export GOPATH=`pwd`/go
  11. export PATH=$GOPATH/bin:$PATH
  12. echo "2. Get the Go plugin for protoc"
  13. go get -a github.com/golang/protobuf/protoc-gen-go
  14. echo "3. Run protoc to generate the service API code"
  15. protoc ../echo.proto --proto_path=.. --go_out=plugins=grpc:go/src/echo
  16. echo "4. Get the server and client dependencies"
  17. go get server
  18. go get client
  19. echo "5. Build the server and client"
  20. go build server
  21. go build client
  22. echo "6. Stop any previously-running instances of the server"
  23. killall server
  24. echo "7. Start the server"
  25. ./server &
  26. echo "8. Run the client"
  27. sleep 1 # give the server some time to start
  28. ./client -m "Remember the milk."
  29. ./client -m "Testing" -s 3