We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d8aac26 commit ad065b8Copy full SHA for ad065b8
ptypes/any.go
@@ -40,7 +40,13 @@ func anyMessageName(any *anypb.Any) (protoreflect.FullName, error) {
40
41
// MarshalAny marshals the given message m into an anypb.Any message.
42
func MarshalAny(m proto.Message) (*anypb.Any, error) {
43
- if dm, ok := m.(*DynamicAny); ok {
+ switch dm := m.(type) {
44
+ case DynamicAny:
45
+ m = dm.Message
46
+ case *DynamicAny:
47
+ if dm == nil {
48
+ return nil, proto.ErrNil
49
+ }
50
m = dm.Message
51
}
52
b, err := proto.Marshal(m)
0 commit comments