Skip to content

Latest commit

 

History

History
78 lines (55 loc) · 1.48 KB

README.md

File metadata and controls

78 lines (55 loc) · 1.48 KB

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
    // ...
}