Package pragma provides certain constructs that can be used to statically enforce
certain language properties.
Change-Id: I58a87bf7429f3be1b5aae418595fadda32f9d039
Reviewed-on: https://go-review.googlesource.com/127822
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Herbie Ong <herbie@google.com>
Package flags defines a set of constants to control support for certain features.
Other flags that may be added in the future may include:
PureGo: to control whether protobuf code should avoid using the unsafe
package and only use Go reflection.
PureProto: to control whether the proto package ignores the protoiface
package and only uses protobuf reflection. This is useful for testing.
Proto2ValidateUTF8: whether to validate UTF-8 in proto2 strings.
Proto3ValidateUTF8: whether to validate UTF-8 in proto3 strings.
Change-Id: Ibcb8dd8b3e977633b8a4e4a22a0617f2eebcc325
Reviewed-on: https://go-review.googlesource.com/127820
Reviewed-by: Damien Neil <dneil@google.com>
Some of the test cases in TestFixed64 actually belong in TestBytes.
Change-Id: I7f3efd77662881b64a96311161440fd220ae8074
Reviewed-on: https://go-review.googlesource.com/127456
Reviewed-by: Chris Manghane <cmang@golang.org>
This adds package errors, which provides error handling constructs that are
specific to the protobuf repo. In particular, it provides a NonFatal type
which is useful for capturing non-fatal errors like invalid UTF-8 and required
fields not set.
High-level API:
type NonFatalErrors []error
func (NonFatalErrors) Error() string
type NonFatal struct{ ... }
func (*NonFatal) Merge(err error) (ok bool)
func (*NonFatal) AppendInvalidUTF8(field string)
func (*NonFatal) AppendRequiredNotSet(field string)
func New(string, ...interface{}) error
Change-Id: I9448c586008240e8987573fe79e0ffb024e7629d
Reviewed-on: https://go-review.googlesource.com/127338
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Herbie Ong <herbie@google.com>
This adds package wire, which provides low-level functionality for
marshaling and unmarshaling the protobuf wire format.
High-level API:
type Number int32
const MinValidNumber Number = 1 ...
type Type int8
const VarintType Type = 0 ...
func ParseError(n int) error
func ConsumeField(b []byte) (Number, Type, int)
func ConsumeFieldValue(num Number, typ Type, b []byte) (n int)
func ConsumeTag(b []byte) (Number, Type, int)
func ConsumeVarint(b []byte) (v uint64, n int)
func ConsumeFixed32(b []byte) (v uint32, n int)
func ConsumeFixed64(b []byte) (v uint64, n int)
func ConsumeBytes(b []byte) (v []byte, n int)
func ConsumeGroup(num Number, b []byte) (v []byte, n int)
func AppendTag(b []byte, num Number, typ Type) []byte
func AppendVarint(b []byte, v uint64) []byte
func AppendFixed32(b []byte, v uint32) []byte
func AppendFixed64(b []byte, v uint64) []byte
func AppendBytes(b []byte, v []byte) []byte
func AppendGroup(b []byte, num Number, v []byte) []byte
func SizeTag(num Number) int
func SizeVarint(v uint64) int
func SizeFixed32() int
func SizeFixed64() int
func SizeBytes(n int) int
func SizeGroup(num Number, n int) int
func DecodeBool(x uint64) bool
func DecodeTag(x uint64) (Number, Type)
func DecodeZigZag(x uint64) int64
func EncodeBool(x bool) uint64
func EncodeTag(num Number, typ Type) uint64
func EncodeZigZag(x int64) uint64
Change-Id: I052d8975414aeb182f6e9595c4736e716f1b7e9d
Reviewed-on: https://go-review.googlesource.com/127337
Reviewed-by: Chris Manghane <cmang@golang.org>
Run-TryBot: Chris Manghane <cmang@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>