wechaty / grpc

gRPC Service & Protocol Buffers for Wechaty Puppet

Home Page:https://wechaty.github.io/grpc/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support GRPC in Go

huan opened this issue · comments

We are working on the Go Wechaty recently, so we will need to support the Go version of our GRPC stubs.

The generating part will be very similar to the TypeScript & Python version that we are already supported. see: @chatie/grpc@NPM & chatie-grpc@PyPI

However, there's a difference between the Go and TypeScript/Python: we need to store the generated Go stub source code in our repository, instead of published to a centralized package manager site.

This is because the designers of the Go do not like a central package manager, which will cause many problems. See: Using Go Modules

So let's design the Go support for our chatie/grpc, I believe it should:

  1. The go module should share the same proto buffer definition files from chatie/grpc repo, which means it should be put into the same DevOps process of our repo here.
  2. The go grpc generator script can be put at scripts/generate-stub-go.sh, like the Python scripts/generate-stub-py.sh as well.
  3. The require path of our chatie-grpc Go module should be: github.com/chatie/grpc/go/
  4. We should add a unit test to make sure the generated go stub version is matching our proto but file version.

This is just my initial version of the design, comments and suggestions are welcome, please feel free to start a discussion under this issue.

Yes, this is the best, I mention pr to try

Great to know that you feel this is good too!

Looking forward to your PR then.

P.S. I'm also considering creating a new repo (e.g. wechaty/go-grpc) to store the generated Go stub codes instead to store in this repo because we will be easy to publish the generated Go code to another repository in our DevOps process, which I believe it will be cleaner and safer.