Make unmarshal to interface{} consistent with encoding/json

This commit is contained in:
Thomas Pelletier
2021-03-23 20:03:45 -04:00
parent 0703eeb262
commit bfeb32c9ce
3 changed files with 51 additions and 32 deletions
+25
View File
@@ -588,6 +588,31 @@ B = "data"`,
}
},
},
{
desc: "interface holding a struct",
input: `[A]
B = "After"`,
gen: func() test {
type inner struct {
B interface{}
}
type doc struct {
A interface{}
}
return test{
target: &doc{
A: inner{
B: "Before",
},
},
expected: &doc{
A: map[string]interface{}{
"B": "After",
},
},
}
},
},
}
for _, e := range examples {