diff options
author | Niall Sheridan <nsheridan@gmail.com> | 2016-12-28 21:18:36 +0000 |
---|---|---|
committer | Niall Sheridan <nsheridan@gmail.com> | 2016-12-28 21:18:36 +0000 |
commit | 73ef85bc5db590c22689e11be20737a3dd88168f (patch) | |
tree | fe393a6f0776bca1889b2113ab341a2922e25d10 /vendor/github.com/golang/protobuf/proto | |
parent | 9e573e571fe878ed32947cae5a6d43cb5d72d3bb (diff) |
Update dependencies
Diffstat (limited to 'vendor/github.com/golang/protobuf/proto')
-rw-r--r-- | vendor/github.com/golang/protobuf/proto/encode.go | 11 | ||||
-rw-r--r-- | vendor/github.com/golang/protobuf/proto/extensions.go | 1 | ||||
-rw-r--r-- | vendor/github.com/golang/protobuf/proto/text_parser.go | 6 |
3 files changed, 15 insertions, 3 deletions
diff --git a/vendor/github.com/golang/protobuf/proto/encode.go b/vendor/github.com/golang/protobuf/proto/encode.go index 68b9b30..2b30f84 100644 --- a/vendor/github.com/golang/protobuf/proto/encode.go +++ b/vendor/github.com/golang/protobuf/proto/encode.go @@ -1075,10 +1075,17 @@ func (o *Buffer) enc_map(p *Properties, base structPointer) error { func (o *Buffer) enc_exts(p *Properties, base structPointer) error { exts := structPointer_Extensions(base, p.field) - if err := encodeExtensions(exts); err != nil { + + v, mu := exts.extensionsRead() + if v == nil { + return nil + } + + mu.Lock() + defer mu.Unlock() + if err := encodeExtensionsMap(v); err != nil { return err } - v, _ := exts.extensionsRead() return o.enc_map_body(v) } diff --git a/vendor/github.com/golang/protobuf/proto/extensions.go b/vendor/github.com/golang/protobuf/proto/extensions.go index 6b9b363..eaad218 100644 --- a/vendor/github.com/golang/protobuf/proto/extensions.go +++ b/vendor/github.com/golang/protobuf/proto/extensions.go @@ -154,6 +154,7 @@ type ExtensionDesc struct { Field int32 // field number Name string // fully-qualified name of extension, for text formatting Tag string // protobuf tag style + Filename string // name of the file in which the extension is defined } func (ed *ExtensionDesc) repeated() bool { diff --git a/vendor/github.com/golang/protobuf/proto/text_parser.go b/vendor/github.com/golang/protobuf/proto/text_parser.go index 4fd0531..61f83c1 100644 --- a/vendor/github.com/golang/protobuf/proto/text_parser.go +++ b/vendor/github.com/golang/protobuf/proto/text_parser.go @@ -592,7 +592,11 @@ func (p *textParser) readStruct(sv reflect.Value, terminator string) error { props = oop.Prop nv := reflect.New(oop.Type.Elem()) dst = nv.Elem().Field(0) - sv.Field(oop.Field).Set(nv) + field := sv.Field(oop.Field) + if !field.IsNil() { + return p.errorf("field '%s' would overwrite already parsed oneof '%s'", name, sv.Type().Field(oop.Field).Name) + } + field.Set(nv) } if !dst.IsValid() { return p.errorf("unknown field name %q in %v", name, st) |