Skip to content

Commit ef36260

Browse files
committed
Assuming interface{} if encountering empty array
1 parent 5e67ff6 commit ef36260

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

json-to-go.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function jsonToGo(json, typename)
6363
if (sliceType == "struct")
6464
parseScope(scope[0]);
6565
else
66-
append(sliceType);
66+
append(sliceType || "interface{}");
6767
}
6868
else
6969
{
@@ -141,9 +141,7 @@ function jsonToGo(json, typename)
141141
&& typ2.substr(0, 5) == "float")
142142
return typ1;
143143
else
144-
{
145144
return "interface{}";
146-
}
147145
}
148146

149147
// Thanks to http://stackoverflow.com/a/5574446/1048862

0 commit comments

Comments
 (0)