summaryrefslogtreecommitdiff
path: root/vendor/github.com/gogo/protobuf/proto/text.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-04-07 20:14:59 +0200
committerGitHub <noreply@github.com>2020-04-07 20:14:59 +0200
commit08fa3d511f2b96613bbbe76e517f2c9288e5bf56 (patch)
tree0210f08935553ea30dd17d4f19086de4b5fa880c /vendor/github.com/gogo/protobuf/proto/text.go
parent9d0d9df6a1973ce9982071601fbdca68c93c6d07 (diff)
parent42fcdbf1a85c8e23ccc25a0e7e66b3a51b8f11dd (diff)
downloadpodman-08fa3d511f2b96613bbbe76e517f2c9288e5bf56.tar.gz
podman-08fa3d511f2b96613bbbe76e517f2c9288e5bf56.tar.bz2
podman-08fa3d511f2b96613bbbe76e517f2c9288e5bf56.zip
Merge pull request #5744 from vrothberg/update-image
vendor c/image v5.4.2
Diffstat (limited to 'vendor/github.com/gogo/protobuf/proto/text.go')
-rw-r--r--vendor/github.com/gogo/protobuf/proto/text.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/vendor/github.com/gogo/protobuf/proto/text.go b/vendor/github.com/gogo/protobuf/proto/text.go
index 0407ba85d..87416afe9 100644
--- a/vendor/github.com/gogo/protobuf/proto/text.go
+++ b/vendor/github.com/gogo/protobuf/proto/text.go
@@ -476,6 +476,8 @@ func (tm *TextMarshaler) writeStruct(w *textWriter, sv reflect.Value) error {
return nil
}
+var textMarshalerType = reflect.TypeOf((*encoding.TextMarshaler)(nil)).Elem()
+
// writeAny writes an arbitrary field.
func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Properties) error {
v = reflect.Indirect(v)
@@ -589,8 +591,8 @@ func (tm *TextMarshaler) writeAny(w *textWriter, v reflect.Value, props *Propert
// mutating this value.
v = v.Addr()
}
- if etm, ok := v.Interface().(encoding.TextMarshaler); ok {
- text, err := etm.MarshalText()
+ if v.Type().Implements(textMarshalerType) {
+ text, err := v.Interface().(encoding.TextMarshaler).MarshalText()
if err != nil {
return err
}