DEV Community

Cover image for Learning Go by examples: part 6 - Create a gRPC app in Go

Learning Go by examples: part 6 - Create a gRPC app in Go

Aurélie Vache on August 18, 2021

In previous articles we created an HTTP REST API server, a CLI, a Bot for Discord and even a game for Nintendo Game Boy Advance. Today let's create...
Collapse
 
mattcale profile image
Matthew Cale •

Command:

go get -u github.com/spf13/cobra/cobra
Enter fullscreen mode Exit fullscreen mode

Fails for me with error:

go get: module github.com/spf13/cobra@upgrade found (v1.4.0), but does not contain package github.com/spf13/cobra/cobra
Enter fullscreen mode Exit fullscreen mode

Instead I used:

go get -u github.com/spf13/cobra@latest
Enter fullscreen mode Exit fullscreen mode
Collapse
 
aurelievache profile image
Aurélie Vache •

Thanks Matthew, it seams that the code organisation has changed on cobra side, I'm fixing it in the article :)

Collapse
 
mattcale profile image
Matthew Cale •

Yep it is a miss on Cobra’s side. Their GH does refer to the right command (now), but the cobra.dev site still has the wrong command. Thanks for contributing this piece and for introducing me to Taskfile.

Thread Thread
 
aurelievache profile image
Aurélie Vache •

Yes, they changed the way to "go get" the dependencies, good to know :)

Collapse
 
yinnovation profile image
Yao •

Thanks for the wonderful tutorial! One update here: the gRPC tool for golang has updated its command syntax so as the output form. One big diff here is that instead of single pb file, there will be 2 separate files: one for populating, serializing, and retrieving proto message types, and one for generated client and server code.

see grpc.io/docs/languages/go/quicksta...

Collapse
 
aurelievache profile image
Aurélie Vache •

Thanks for your comment! I will update it, thx!

Collapse
 
johanpiquet profile image
Johan PIQUET •

Thank you Aurélie! ... and I love your drawing :-)

Collapse
 
aurelievache profile image
Aurélie Vache •

Thanks Johan :-)

Collapse
 
hrittikhere profile image
Hrittik Roy •

Hi @aurelievache this is awesome! Can we expect some how to CLI tools in this series?

Collapse
 
aurelievache profile image
Aurélie Vache •

Hi
I already show how to create a CLI app in Go.
What kind of CLI tools do you need?

Collapse
 
hrittikhere profile image
Hrittik Roy •

I just missed that post. I will try that out and update you if some good idea pops up. Thanks for creating this series it's very helpful! :D

Collapse
 
nikola_mandivic profile image
Nikola Mandivic •

One of those developers that explain things unnecessarily complicated. I spent a little over an hour here and learned nothing. Maybe this tutorial is meant for a minority group of "geeks" that like fancy libraries that nobody heard of. Who cares about "cobra".

Collapse
 
boredabdel profile image
Abdel SGHIOUAR •

Literally every developer who writes CLI's in Go uses Cobra. The project has 27k stars in Github (github.com/spf13/cobra) and is used by Docker, helm, skaffold among other popular tools.

Sorry if you job is to write Frontend apps :)

Collapse
 
nikola_mandivic profile image
Nikola Mandivic •

There are many libraries out there that have lots of stars and supported by Docker but not mainstream at all. I don't think I was talking about cobra specifically anyway. Not sure why you were hung up on that. Anyways, pretty confusing tutorial. It's like watching someone going through backendless rather than firestore.

Thread Thread
 
aurelievache profile image
Aurélie Vache • • Edited

Can you explain the troubles with this step by step tutorial?

Collapse
 
burneyhoel profile image
Burney Hoel •

Agreed, keep them coming!

Collapse
 
aurelievache profile image
Aurélie Vache •

Thanks!

Have you some idea of others episodes?

Thread Thread
 
burneyhoel profile image
Burney Hoel •

@aurelievache What I love about your series is that the projects are fun. You are not just exploring the language but what can be done with it. I think the topics below are neat and could fit your series.

• Grpc-web, and or the improbable implementation (improbable-eng/grpc-web)
• Go and web assembly
• Fuzz testing is new and could be neat.
• Not out yet but in go 1.18, generics

Thread Thread
 
aurelievache profile image
Aurélie Vache •

Thanks for your ideas! 🙂
I will explore other kind of apps, web assembly is on my list too ^^

Collapse
 
aurelievache profile image
Aurélie Vache •

Thanks Julien! 😘

Collapse
 
xxddpac profile image
大米 •

nice article