type RequiredNotSetError … func (e *RequiredNotSetError) Error() string { … } func (e *RequiredNotSetError) RequiredNotSet() bool { … } type invalidUTF8Error … func (e *invalidUTF8Error) Error() string { … } func (e *invalidUTF8Error) InvalidUTF8() bool { … } var errInvalidUTF8 … // isNonFatal reports whether the error is either a RequiredNotSet error // or a InvalidUTF8 error. func isNonFatal(err error) bool { … } type nonFatal … // Merge merges err into nf and reports whether it was successful. // Otherwise it returns false for any fatal non-nil errors. func (nf *nonFatal) Merge(err error) (ok bool) { … } type Message … type Buffer … // NewBuffer allocates a new Buffer and initializes its internal data to // the contents of the argument slice. func NewBuffer(e []byte) *Buffer { … } // Reset resets the Buffer, ready for marshaling a new protocol buffer. func (p *Buffer) Reset() { … } // SetBuf replaces the internal buffer with the slice, // ready for unmarshaling the contents of the slice. func (p *Buffer) SetBuf(s []byte) { … } // Bytes returns the contents of the Buffer. func (p *Buffer) Bytes() []byte { … } // SetDeterministic sets whether to use deterministic serialization. // // Deterministic serialization guarantees that for a given binary, equal // messages will always be serialized to the same bytes. This implies: // // - Repeated serialization of a message will return the same bytes. // - Different processes of the same binary (which may be executing on // different machines) will serialize equal messages to the same bytes. // // Note that the deterministic serialization is NOT canonical across // languages. It is not guaranteed to remain stable over time. It is unstable // across different builds with schema changes due to unknown fields. // Users who need canonical serialization (e.g., persistent storage in a // canonical form, fingerprinting, etc.) should define their own // canonicalization specification and implement their own serializer rather // than relying on this API. // // If deterministic serialization is requested, map entries will be sorted // by keys in lexographical order. This is an implementation detail and // subject to change. func (p *Buffer) SetDeterministic(deterministic bool) { … } // Bool is a helper routine that allocates a new bool value // to store v and returns a pointer to it. func Bool(v bool) *bool { … } // Int32 is a helper routine that allocates a new int32 value // to store v and returns a pointer to it. func Int32(v int32) *int32 { … } // Int is a helper routine that allocates a new int32 value // to store v and returns a pointer to it, but unlike Int32 // its argument value is an int. func Int(v int) *int32 { … } // Int64 is a helper routine that allocates a new int64 value // to store v and returns a pointer to it. func Int64(v int64) *int64 { … } // Float32 is a helper routine that allocates a new float32 value // to store v and returns a pointer to it. func Float32(v float32) *float32 { … } // Float64 is a helper routine that allocates a new float64 value // to store v and returns a pointer to it. func Float64(v float64) *float64 { … } // Uint32 is a helper routine that allocates a new uint32 value // to store v and returns a pointer to it. func Uint32(v uint32) *uint32 { … } // Uint64 is a helper routine that allocates a new uint64 value // to store v and returns a pointer to it. func Uint64(v uint64) *uint64 { … } // String is a helper routine that allocates a new string value // to store v and returns a pointer to it. func String(v string) *string { … } // EnumName is a helper function to simplify printing protocol buffer enums // by name. Given an enum map and a value, it returns a useful string. func EnumName(m map[int32]string, v int32) string { … } // UnmarshalJSONEnum is a helper function to simplify recovering enum int values // from their JSON-encoded representation. Given a map from the enum's symbolic // names to its int values, and a byte buffer containing the JSON-encoded // value, it returns an int32 that can be cast to the enum type by the caller. // // The function can deal with both JSON representations, numeric and symbolic. func UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, error) { … } // DebugPrint dumps the encoded data in b in a debugging format with a header // including the string s. Used in testing but made available for general debugging. func (p *Buffer) DebugPrint(s string, b []byte) { … } // SetDefaults sets unset protocol buffer fields to their default values. // It only modifies fields that are both unset and have defined defaults. // It recursively sets default values in any non-nil sub-messages. func SetDefaults(pb Message) { … } // v is a struct. func setDefaults(v reflect.Value, recur, zeros bool) { … } var defaultMu … var defaults … var int32PtrType … type defaultMessage … type scalarField … // t is a struct type. func buildDefaultMessage(t reflect.Type) (dm defaultMessage) { … } // fieldDefault returns the scalarField for field type ft. // sf will be nil if the field can not have a default. // nestedMessage will be true if this is a nested message. // Note that sf.index is not set on return. func fieldDefault(ft reflect.Type, prop *Properties) (sf *scalarField, nestedMessage bool, err error) { … } // mapKeys returns a sort.Interface to be used for sorting the map keys. // Map fields may have key types of non-float scalars, strings and enums. func mapKeys(vs []reflect.Value) sort.Interface { … } type mapKeySorter … func (s mapKeySorter) Len() int { … } func (s mapKeySorter) Swap(i, j int) { … } func (s mapKeySorter) Less(i, j int) bool { … } // isProto3Zero reports whether v is a zero proto3 value. func isProto3Zero(v reflect.Value) bool { … } const GoGoProtoPackageIsVersion3 … const GoGoProtoPackageIsVersion2 … const GoGoProtoPackageIsVersion1 … type InternalMessageInfo …