Documentation ¶
Overview ¶
Package textpb can reformat text protos to be prettier.
It is needed because "google.golang.org/protobuf/encoding/prototext" intentionally produces unstable output (inserting spaces in random places) and it very zealously escapes JSON-valued fields making them unreadable.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Format ¶
func Format(blob []byte, desc protoreflect.MessageDescriptor) ([]byte, error)
Format reformats a text proto of the given type to be prettier.
Normalizes whitespaces and converts JSON-valued fields to be multi-line string literals instead of one giant string with "\n" inside. A string field can be annotated as containing JSON via field options:
import "go.chromium.org/luci/common/proto/options.proto"; message MyMessage { string my_field = 1 [(luci.text_pb_format) = JSON]; }
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.