草庐IT

ReportElement

全部标签

go - Struct Json Marshaling导致堆栈溢出

问题当我在我的代码中使用NewChild()函数并随后将“报告”结构编码为JSON时,我得到一个堆栈溢出(goroutine堆栈超过1000000000字节限制)经过研究我发现它应该做一些无限递归的事情,但我不知道为什么我的代码应该有那个。代码typeReportstruct{TestSuites[]ReportElementTestsintSuccessintFailedintRoot*ReportElementCurrentElement*ReportElement`json:"-"`}typeReportElementstruct{SuccessboolTimeboolLogSt