summaryrefslogtreecommitdiff
path: root/vendor/github.com/matttproud/golang_protobuf_extensions
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/matttproud/golang_protobuf_extensions')
-rw-r--r--vendor/github.com/matttproud/golang_protobuf_extensions/v2/LICENSE (renamed from vendor/github.com/matttproud/golang_protobuf_extensions/LICENSE)0
-rw-r--r--vendor/github.com/matttproud/golang_protobuf_extensions/v2/NOTICE (renamed from vendor/github.com/matttproud/golang_protobuf_extensions/NOTICE)0
-rw-r--r--vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/.gitignore (renamed from vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/.gitignore)0
-rw-r--r--vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/Makefile (renamed from vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/Makefile)0
-rw-r--r--vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/decode.go (renamed from vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/decode.go)16
-rw-r--r--vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/doc.go (renamed from vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/doc.go)0
-rw-r--r--vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/encode.go (renamed from vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode.go)5
7 files changed, 15 insertions, 6 deletions
diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/LICENSE b/vendor/github.com/matttproud/golang_protobuf_extensions/v2/LICENSE
index 8dada3eda..8dada3eda 100644
--- a/vendor/github.com/matttproud/golang_protobuf_extensions/LICENSE
+++ b/vendor/github.com/matttproud/golang_protobuf_extensions/v2/LICENSE
diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/NOTICE b/vendor/github.com/matttproud/golang_protobuf_extensions/v2/NOTICE
index 5d8cb5b72..5d8cb5b72 100644
--- a/vendor/github.com/matttproud/golang_protobuf_extensions/NOTICE
+++ b/vendor/github.com/matttproud/golang_protobuf_extensions/v2/NOTICE
diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/.gitignore b/vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/.gitignore
index e16fb946b..e16fb946b 100644
--- a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/.gitignore
+++ b/vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/.gitignore
diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/Makefile b/vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/Makefile
index 81be21437..81be21437 100644
--- a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/Makefile
+++ b/vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/Makefile
diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/decode.go b/vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/decode.go
index 258c0636a..7c08e564f 100644
--- a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/decode.go
+++ b/vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/decode.go
@@ -19,9 +19,10 @@ import (
"errors"
"io"
- "github.com/golang/protobuf/proto"
+ "google.golang.org/protobuf/proto"
)
+// TODO: Give error package name prefix in next minor release.
var errInvalidVarint = errors.New("invalid varint32 encountered")
// ReadDelimited decodes a message from the provided length-delimited stream,
@@ -36,6 +37,12 @@ var errInvalidVarint = errors.New("invalid varint32 encountered")
// of the stream has been reached in doing so. In that case, any subsequent
// calls return (0, io.EOF).
func ReadDelimited(r io.Reader, m proto.Message) (n int, err error) {
+ // TODO: Consider allowing the caller to specify a decode buffer in the
+ // next major version.
+
+ // TODO: Consider using error wrapping to annotate error state in pass-
+ // through cases in the next minor version.
+
// Per AbstractParser#parsePartialDelimitedFrom with
// CodedInputStream#readRawVarint32.
var headerBuf [binary.MaxVarintLen32]byte
@@ -53,15 +60,14 @@ func ReadDelimited(r io.Reader, m proto.Message) (n int, err error) {
if err != nil {
return bytesRead, err
}
- // A Reader should not return (0, nil), but if it does,
- // it should be treated as no-op (according to the
- // Reader contract). So let's go on...
+ // A Reader should not return (0, nil); but if it does, it should
+ // be treated as no-op according to the Reader contract.
continue
}
bytesRead += newBytesRead
// Now present everything read so far to the varint decoder and
// see if a varint can be decoded already.
- messageLength, varIntBytes = proto.DecodeVarint(headerBuf[:bytesRead])
+ messageLength, varIntBytes = binary.Uvarint(headerBuf[:bytesRead])
}
messageBuf := make([]byte, messageLength)
diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/doc.go b/vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/doc.go
index c318385cb..c318385cb 100644
--- a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/doc.go
+++ b/vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/doc.go
diff --git a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode.go b/vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/encode.go
index 8fb59ad22..e58dd9d29 100644
--- a/vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode.go
+++ b/vendor/github.com/matttproud/golang_protobuf_extensions/v2/pbutil/encode.go
@@ -18,7 +18,7 @@ import (
"encoding/binary"
"io"
- "github.com/golang/protobuf/proto"
+ "google.golang.org/protobuf/proto"
)
// WriteDelimited encodes and dumps a message to the provided writer prefixed
@@ -28,6 +28,9 @@ import (
// number of bytes written and any applicable error. This is roughly
// equivalent to the companion Java API's MessageLite#writeDelimitedTo.
func WriteDelimited(w io.Writer, m proto.Message) (n int, err error) {
+ // TODO: Consider allowing the caller to specify an encode buffer in the
+ // next major version.
+
buffer, err := proto.Marshal(m)
if err != nil {
return 0, err