- You will need
protoc
to generate proto buffer code.
$ brew install protobuf
$ protoc --version
- Install the protocol compiler plugins for Go using the following commands:
$ go install google.golang.org/protobuf/cmd/[email protected]
$ go install google.golang.org/grpc/cmd/[email protected]
- Update your
PATH
so that the protoc compiler can find the plugins:
$ export PATH="$PATH:$(go env GOPATH)/bin"
- Create folder for protobuf files
$ mkdir chat
- Paste the following code into the terminal screen or run the make command
$ protoc --go_out=. --go_opt=paths=source_relative \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
chat/chat.proto
or command line
$ make generate_grpc_code
$ go run server.go
and open a new terminal screen
$ go run client.go --name=John Wick