protog is a toolkit for Google's protobuf and gRPC projects. It contains a couple of Go packages and command line tools.
It is developed against the protobuf-go v2 API (google.golang.org/protobuf) which simplifies a lot of reflection-based protobuf code compared to v1 (github.com/golang/protobuf).
Build, test and install with make
. See further options with make help
.
pb
is a CLI tool for converting proto messages between different formats.
Sample usage:
# create base-massage.pb binary encoded proto message file from input JSON
pb -P cmd/pb/testdata/pbtest.pb -o base-message.pb BaseMessage '{"f" : "some_field"}'
# convert binary encoded proto message from pb file back to JSON
pb -P cmd/pb/testdata/pbtest.pb -O json BaseMessage @base-message.pb
Output:
{
"f": "some_field"
}