Documentation ¶
Overview ¶
Package proto contains protobuf-related utilities.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
// optional luci.Metadata file_metadata = 73700;
E_FileMetadata = &file_go_chromium_org_luci_common_proto_options_proto_extTypes[0]
)
Extension fields to descriptorpb.FileOptions.
var File_go_chromium_org_luci_common_proto_options_proto protoreflect.FileDescriptor
Functions ¶
func FixFieldMasksBeforeUnmarshal ¶
FixFieldMasksBeforeUnmarshal reads FieldMask fields from a JSON-encoded message, parses them as a string according to https://github.com/protocolbuffers/protobuf/blob/ec1a70913e5793a7d0a7b5fbf7e0e4f75409dd41/src/google/protobuf/field_mask.proto#L180 and converts them to a JSON serialization format that Golang Protobuf library can unmarshal from. It is a workaround for https://github.com/golang/protobuf/issues/745.
This function is a reverse of FixFieldMasksAfterMarshal.
messageType must be a struct, not a struct pointer.
WARNING: AVOID. LIKELY BUGGY, see https://crbug.com/1028915.
func MatcherEqual ¶
MatcherEqual returns a matcher that matches on protobuf equality. Note: reflect.DeepEqual can't be used with protobuf messages as it may yield unexpected results.
func ParseMultilineStrings ¶
ParseMultilineStrings looks for bash-style heredocs and replaces them with single-line text-proto-escaped strings.
This looks line by line for /<<\s*([_a-zA-Z]+)\s*$/. If this is found, the scanner then looks until it finds /^\s*\1\s*$/. Every line between these is joined like "\n".join(lines), and then printed back as an escaped proto string. The scanner then loops back to its initial state.
Not that nothing special needs to be done for e.g.
some_key: "string with << angles"
Such a line would be left alone, because the trailing quote (which is mandatory in text proto) cause the starting regex to not match.
For convenience, the inner lines will be treated with the equivalent of python's `textwrap.dedent`; any common leading whitespace that occurs on every line will be removed. Although both tabs and spaces count as whitespace, they are not equivalent (i.e. only exactly-matching whitespace prefixes count)
The only error this may return is if there's an open heredoc without a matching close marker.
Example:
this: <<EOF would turn \ninto a "single" line EOF
Turns into the same as:
this: "would\nturn \\ninto\n a \"single\"\nline"
Types ¶
type Metadata ¶
type Metadata struct { // URL to a human-readable proto schema definition doc. DocUrl *string `protobuf:"bytes,1,opt,name=doc_url,json=docUrl" json:"doc_url,omitempty"` // contains filtered or unexported fields }
func (*Metadata) Descriptor
deprecated
func (*Metadata) ProtoMessage ¶
func (*Metadata) ProtoMessage()
func (*Metadata) ProtoReflect ¶
func (x *Metadata) ProtoReflect() protoreflect.Message
Directories ¶
Path | Synopsis |
---|---|
Package access contains Access service protocol.
|
Package access contains Access service protocol. |
Package config contains luci-config protobuf definitions.
|
Package config contains luci-config protobuf definitions. |
Package examples shows how to design protos which adhere to the Google Cloud API design guide.
|
Package examples shows how to design protos which adhere to the Google Cloud API design guide. |
Package gerrit contains Gerrit service definition.
|
Package gerrit contains Gerrit service definition. |
Package git contains Git-related protobuf definitions.
|
Package git contains Git-related protobuf definitions. |
Package gitiles contains Gitiles service definition.
|
Package gitiles contains Gitiles service definition. |
mock_gitiles
Package mock_gitiles is a generated GoMock package.
|
Package mock_gitiles is a generated GoMock package. |
google
|
|
descutil
Package descutil contains utility functions for protobuf descriptor messages.
|
Package descutil contains utility functions for protobuf descriptor messages. |
internal
|
|
Package mask provides utility functions for google protobuf field mask Supports advanced field mask semantics: - Refer to fields and map keys using .
|
Package mask provides utility functions for google protobuf field mask Supports advanced field mask semantics: - Refer to fields and map keys using . |
Package paged implements a helper for making paginated Datastore queries.
|
Package paged implements a helper for making paginated Datastore queries. |
Package realms contains LUCI Realms protobuf definitions.
|
Package realms contains LUCI Realms protobuf definitions. |
Package srcman contains source manifest protobuf definitions.
|
Package srcman contains source manifest protobuf definitions. |