I need to create generate gRPC code which needed to publish in gitLab (this is done). Now, I need a way how I can import this gRPC code in my another GoLang project(there can be many projects).
Asked
Active
Viewed 375 times
1
-
If the go code (i.e. the output from `protoc`) is in a public gitlab repo then you can just import it (e.g. `import gitlab.com/talex-coding-dojo/kite-base/pb/events` (it's just like any other go package - found the example repo with a quick search). For a more detailed answer you will need to provide additional information. – Brits Aug 22 '22 at 09:22
-
we have private gitlab repo. If any article could help how we can get package from private gitlab to Go- project will be great help. – Vikash Mishra Aug 23 '22 at 06:50
-
From private gitlab should be possible (see [this question](https://stackoverflow.com/q/29707689/11810946); I don't use gitlab myself so cant say too much!). Note that the newish [git credential manager](https://github.blog/2022-04-07-git-credential-manager-authentication-for-everyone) may make this simpler (it certainly simplified things for me with private Bitbucket repos, which I do use to host the generated packages). You may find [this answer](https://stackoverflow.com/a/73423272/11810946) helpful (works through a few options). – Brits Aug 23 '22 at 07:54
1 Answers
0
For example, you can use a buf.build as a source of truth for your protobuf schemas.
Once create a repository there, you can fetch the proto files and generate a client/server on your side (buf generate
), or use the already generated go packages.

Paramtamtаm
- 312
- 5
- 12