diff --git a/types.go b/types.go index 41398f4..8d6665b 100644 --- a/types.go +++ b/types.go @@ -194,10 +194,6 @@ func UnmarshalToByTypeURL(typeURL string, value []byte, out interface{}) error { } func unmarshal(typeURL string, value []byte, v interface{}) (interface{}, error) { - if value == nil { - return nil, nil - } - t, err := getTypeByUrl(typeURL) if err != nil { return nil, err diff --git a/types_test.go b/types_test.go index 7e82bf5..d7121b2 100644 --- a/types_test.go +++ b/types_test.go @@ -195,27 +195,6 @@ func TestRegisterDiffUrls(t *testing.T) { Register(&test{}, "test", "two") } -func TestUnmarshalNil(t *testing.T) { - var pba *anypb.Any // This is nil. - var a Any = pba // This is typed nil. - - if pba != nil { - t.Fatal("pbany must be nil") - } - if a == nil { - t.Fatal("nilany must not be nil") - } - - actual, err := UnmarshalAny(a) - if err != nil { - t.Fatal(err) - } - - if actual != nil { - t.Fatalf("expected nil, got %v", actual) - } -} - func TestCheckNil(t *testing.T) { var a *anyType