Skip to content

Instantly share code, notes, and snippets.

@harishb2k
Last active July 15, 2021 20:46
Show Gist options
  • Select an option

  • Save harishb2k/d8e8b21bf2ccdc5cb9b15e4a20ef5827 to your computer and use it in GitHub Desktop.

Select an option

Save harishb2k/d8e8b21bf2ccdc5cb9b15e4a20ef5827 to your computer and use it in GitHub Desktop.
how to generate Proto file for Golang
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.1

This will read hello.proto and put both proto and grpc file inside folder "pb".

protoc --go_out=pb --go_opt=paths=source_relative --go-grpc_out=pb --go-grpc_opt=paths=source_relative hello.proto

Note - both "go_out" and "go-grpc_out" are set as folder "pb"

Example project

https://github.com/harishb2k/golang_grpc_with_opentracing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment