brew install protobuf
go get -u github.com/golang/protobuf/{proto,protoc-gen-go}
go get google.golang.org/grpc
*.proto
to *.pb.go
cd proto
protoc --go_out=plugins=grpc:. *.proto
Only one main
can be declared in same file and the same package name.
# client/
go run client.go
# server/
go run server.go
# client/stream
go run clientStream.go
# server/stream
go run serverStream.go
- Use
{GOROOT}\src\crypto\tls\generate_cert.go
to generatecert.pem
andkey.pem
- Import them