Skip to content

Stupid simple sample to try gRPC and Go (blatantly ripped from the official helloworld example).

Notifications You must be signed in to change notification settings

joaofbantunes/grpcsample-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

Stupid simple sample to try gRPC and Go (blatantly ripped from the official helloworld example).

This will be used as a server (although there's a client here for testing), and there's a C# client here.

Consider I'm on Windows for the next steps

Steps I took (setup)

  1. Installed Protobuf compiler (protoc)
  2. Installed Go :)
  3. Set GOPATH environment variable to where the projects will be kept
  4. Installed gRPC for Go go get google.golang.org/grpc
  5. Installed the Go code generator plugin go get -u github.com/golang/protobuf/protoc-gen-go (it will be on the GOPATH and protoc is able to find it)

Steps I took (development)

  1. Created the project folder under src, under GOPATH
  2. Created the service definition (servicedef folder), consisting on the messages to pass (IncrementRequest and IncrementResponse) and the available operations (service Counter.Increment)
  3. Generated the Go files from the proto definition running the following command on the root of the project protoc --go_out=plugins=grpc:generated servicedef/*.proto
  4. Installed the generated package on my GOPATH by running the following command (still on the project root) go install ./generated/servicedef
  5. Implemented the server on server\main.go and the client on client\main.go
  6. On a command window ran the server go run server\main.go
  7. On another command window ran the client go run client\main.go
  8. Stuff works, YAY!

Notes

Followed parts of the gRPC Go Quick Start and the helloworld example.

About

Stupid simple sample to try gRPC and Go (blatantly ripped from the official helloworld example).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published