From ced29f9fca7aab93602bb1b8c3c2bf175c4cca09 Mon Sep 17 00:00:00 2001 From: walon Date: Mon, 14 Mar 2022 11:10:48 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E5=A4=8D=E3=80=91=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E7=94=9F=E6=88=90=E7=9A=84go=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=AF=BB=E5=8F=96=E5=8F=AF=E7=A9=BA=E5=8F=98=E9=87=8F=E7=9A=84?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Source/TypeVisitors/GoDeserializeJsonVisitor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Luban.Job.Cfg/Source/TypeVisitors/GoDeserializeJsonVisitor.cs b/src/Luban.Job.Cfg/Source/TypeVisitors/GoDeserializeJsonVisitor.cs index 3182171..8a46cc9 100644 --- a/src/Luban.Job.Cfg/Source/TypeVisitors/GoDeserializeJsonVisitor.cs +++ b/src/Luban.Job.Cfg/Source/TypeVisitors/GoDeserializeJsonVisitor.cs @@ -12,7 +12,7 @@ namespace Luban.Job.Cfg.TypeVisitors if (type.IsNullable) { var jsonObjName = $"__json_{fieldName}__"; - return $"{{ var _ok_ bool; var {jsonObjName} interface{{}}; if {jsonObjName}, _ok_ = {bufName}[\"{fieldName}\"]; !_ok_ || {jsonObjName} == nil {{ return }} else {{ var __x__ {type.Apply(GoTypeUnderingNameVisitor.Ins)}; {type.Apply(GoDeserializeJsonUndering2Visitor.Ins, "__x__", jsonObjName)}; {varName} = {(type.Apply(GoIsPointerTypeVisitor.Ins) ? "&" : "")}__x__ }}}}"; + return $"{{ var _ok_ bool; var {jsonObjName} interface{{}}; if {jsonObjName}, _ok_ = {bufName}[\"{fieldName}\"]; !_ok_ || {jsonObjName} == nil {{ {varName} = nil }} else {{ var __x__ {type.Apply(GoTypeUnderingNameVisitor.Ins)}; {type.Apply(GoDeserializeJsonUndering2Visitor.Ins, "__x__", jsonObjName)}; {varName} = {(type.Apply(GoIsPointerTypeVisitor.Ins) ? "&" : "")}__x__ }}}}"; } else {