util/reflect: return pointer from helper funcs

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2021-05-25 22:44:22 +03:00
parent 34f0b209cc
commit 60a5e737f8
2 changed files with 21 additions and 16 deletions

View File

@@ -17,9 +17,9 @@ func TestStructByTag(t *testing.T) {
t.Fatal(err)
}
if v, ok := iface.([]string); !ok {
t.Fatalf("not []string %v", iface)
} else if len(v) != 2 {
if v, ok := iface.(*[]string); !ok {
t.Fatalf("not *[]string %v", iface)
} else if len(*v) != 2 {
t.Fatalf("invalid number %v", iface)
}
}
@@ -36,9 +36,9 @@ func TestStructByName(t *testing.T) {
t.Fatal(err)
}
if v, ok := iface.([]string); !ok {
t.Fatalf("not []string %v", iface)
} else if len(v) != 2 {
if v, ok := iface.(*[]string); !ok {
t.Fatalf("not *[]string %v", iface)
} else if len(*v) != 2 {
t.Fatalf("invalid number %v", iface)
}
}