Skip to content

camrynl/go-grpc

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

18 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

gRPC on Go

This projects you a start point for building a client and a server that communicates with gRPC. I also published a blog article series if you are interested.

Install ๐Ÿ—

Protobufs

brew instal protobuf

Go plugins for the protobuf compiler or refer here

make install

Invoking RPCs ๐Ÿš€

# Note: since we are not using TLS all the calls are with -plaintext flag
grpcurl -plaintext localhost:8080 list # introspect the service
grpcurl -plaintext localhost:8080 Inventory.GetBookList # to get a list of books

Useful commands ๐Ÿ“ก

Generate Go stubs

make gen

Clean stubs

make clean

Common issues and FAQ โ“

  1. VS Code complains about imports?

Known issue with the Proto3 VS Code plugin. Add the following to your settings.json file

"protoc": {
        "path": "/path/to/protoc",
        "compile_on_save": false,
        "options": [
            "--proto_path=protos/v3",
            "--proto_path=protos/v2",
            "--proto_path=${workspaceRoot}/proto",
            "--proto_path=${env.GOPATH}/src",
            "--java_out=gen/java"
        ]
    }

Run which protoc to find your proto compiler path.

  1. Auto formatter doesn't work?
brew install clang-format

Add the following to your settings.json

{
    // ...
    "editor.formatOnSave": true
    // ...
}

About

๐ŸŽฏ A simple gRPC web service written in Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 48.8%
  • Shell 25.5%
  • Dockerfile 14.2%
  • Makefile 11.5%