xP: fix log JSON serialization
This commit is contained in:
parent
92f2f6895b
commit
b53fc1918f
@ -100,6 +100,7 @@ function codegen_begin() {
|
|||||||
print "package main"
|
print "package main"
|
||||||
print ""
|
print ""
|
||||||
print "import ("
|
print "import ("
|
||||||
|
print "\t`encoding/base64`"
|
||||||
print "\t`encoding/binary`"
|
print "\t`encoding/binary`"
|
||||||
print "\t`encoding/json`"
|
print "\t`encoding/json`"
|
||||||
print "\t`errors`"
|
print "\t`errors`"
|
||||||
@ -274,6 +275,14 @@ function codegen_struct_field_marshal(d, cg, camel, f, marshal) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (d["type"] == "u8") {
|
||||||
|
append(cg, "marshal",
|
||||||
|
"\tb = append(b, `,\"" decapitalize(camel) "\":\"`...)\n" \
|
||||||
|
"\tb = append(b, base64.StdEncoding.EncodeToString(" f ")...)\n" \
|
||||||
|
"\tb = append(b, '\"')\n")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (CodegenIsMarshaler[d["type"]])
|
if (CodegenIsMarshaler[d["type"]])
|
||||||
marshal = f "[i].MarshalJSON()"
|
marshal = f "[i].MarshalJSON()"
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user