From fee324e25a84c51f67d67ad76279b73167054726 Mon Sep 17 00:00:00 2001 From: Tnze Date: Sat, 27 Apr 2024 21:01:23 +0800 Subject: [PATCH] Rename inner type name --- chat/message.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/chat/message.go b/chat/message.go index 0f0ff7c..49e47df 100644 --- a/chat/message.go +++ b/chat/message.go @@ -102,13 +102,13 @@ type translateMsg struct { Extra []Message `json:"extra,omitempty"` } -type jsonMsg Message +type rawMsgStruct Message func (m Message) MarshalJSON() ([]byte, error) { if m.Translate != "" { return json.Marshal(translateMsg(m)) } else { - return json.Marshal(jsonMsg(m)) + return json.Marshal(rawMsgStruct(m)) } } @@ -124,7 +124,7 @@ func (m *Message) UnmarshalJSON(raw []byte) (err error) { case '"': return json.Unmarshal(raw, &m.Text) // Unmarshal as jsonString case '{': - return json.Unmarshal(raw, (*jsonMsg)(m)) // Unmarshal as jsonMsg + return json.Unmarshal(raw, (*rawMsgStruct)(m)) // Unmarshal as jsonMsg case '[': return json.Unmarshal(raw, &m.Extra) // Unmarshal as []Message default: