encode: fix embedded interfaces (#753)

Resolve marshaling regression when handling an embedded interface in a
struct.

Fixes #752
This commit is contained in:
Thomas Pelletier
2022-04-08 09:25:54 -04:00
committed by GitHub
parent f5cc8c49eb
commit 2377ac4bc0
2 changed files with 19 additions and 1 deletions
+3 -1
View File
@@ -600,7 +600,9 @@ func walkStruct(ctx encoderCtx, t *table, v reflect.Value) {
if k == "" {
if fieldType.Anonymous {
walkStruct(ctx, t, f)
if fieldType.Type.Kind() == reflect.Struct {
walkStruct(ctx, t, f)
}
continue
} else {
k = fieldType.Name