mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-03 10:37:46 +00:00
reflect: tweak Type.String() to match what encoding/json expects for empty structs
This commit is contained in:
+4
-1
@@ -527,8 +527,11 @@ func (t *rawType) String() string {
|
||||
case Map:
|
||||
return "map[" + t.key().String() + "]" + t.elem().String()
|
||||
case Struct:
|
||||
s := "struct {"
|
||||
numField := t.NumField()
|
||||
if numField == 0 {
|
||||
return "struct {}"
|
||||
}
|
||||
s := "struct {"
|
||||
for i := 0; i < numField; i++ {
|
||||
f := t.rawField(i)
|
||||
s += " " + f.Name + " " + f.Type.String()
|
||||
|
||||
Reference in New Issue
Block a user