我正在嘗試在具有多級(jí)嵌套的復(fù)雜結(jié)構(gòu)中取消封送一些數(shù)據(jù)(因此,此處不復(fù)制該結(jié)構(gòu))。然而,當(dāng)代碼上線時(shí),我們開(kāi)始在極少數(shù)情況下出現(xiàn)以下恐慌(難以量化,但可能是1000例中的1例)。以下是該問(wèn)題的堆棧跟蹤:panic: reflect: call of reflect.Value.Int on zero Value [recovered] panic: reflect: call of reflect.Value.Int on zero Value goroutine 568428 [running]: encoding/json.(*encodeState).marshal.func1(0xc0081d5c70) /usr/local/go/src/encoding/json/encode.go:305 +0x9a panic(0x13968c0, 0xc005c2f540) /usr/local/go/src/runtime/panic.go:679 +0x1b2 reflect.Value.Int(...) /usr/local/go/src/reflect/value.go:986 encoding/json.intEncoder(0xc0074b5dc0, 0x0, 0x0, 0x0, 0xc0038b0100) /usr/local/go/src/encoding/json/encode.go:522 +0x1d4 encoding/json.mapEncoder.encode(0x1608760, 0xc0074b5dc0, 0x1385c20, 0xc00119f5e0, 0x195, 0x100) /usr/local/go/src/encoding/json/encode.go:706 +0x351 encoding/json.structEncoder.encode(0xc0002ce600, 0x19, 0x21, 0xc00027ede0, 0xc0074b5dc0, 0x156c820, 0xc00119f510, 0x199, 0x520100) /usr/local/go/src/encoding/json/encode.go:664 +0x306 encoding/json.ptrEncoder.encode(0xc00027ee10, 0xc0074b5dc0, 0x1397e80, 0xc00119f510, 0x16, 0x1390100) /usr/local/go/src/encoding/json/encode.go:810 +0xb1 encoding/json.(*encodeState).reflectValue(0xc0074b5dc0, 0x1397e80, 0xc00119f510, 0x16, 0x100) /usr/local/go/src/encoding/json/encode.go:337 +0x82 encoding/json.(*encodeState).marshal(0xc0074b5dc0, 0x1397e80, 0xc00119f510, 0xc003da0100, 0x0, 0x0) /usr/local/go/src/encoding/json/encode.go:309 +0x10b encoding/json.Marshal(0x1397e80, 0xc00119f510, 0x40be53, 0x13c4160, 0x1397e80, 0x1, 0x7fa9d5d348b0) /usr/local/go/src/encoding/json/encode.go:161 +0x52 reingames.com/rm/user.(*userCore).MarshalBinary(0xc00119f510, 0x1397e80, 0xc00119f510, 0x7fa9d5d348b0, 0xc00119f510, 0x1) /home/shivam/goprojects/rmgs/go/user/profile.go:180 +0x37我不知道從哪里開(kāi)始調(diào)試它。有沒(méi)有人經(jīng)歷過(guò)類似的事情?快速問(wèn)題 - 爭(zhēng)用條件(在更新指針時(shí)對(duì)其進(jìn)行編組)是否會(huì)導(dǎo)致這種恐慌?
查看完整描述