From b8d0d0c3b6b2ffe40921aa4c247c101dd0ce958d Mon Sep 17 00:00:00 2001 From: Keuin Date: Sat, 1 Jul 2023 22:10:22 +0800 Subject: Refactor: rename consts to follow Go idiom. Fix const comment style. --- danmaku/dmmsg/danmu.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'danmaku/dmmsg/danmu.go') diff --git a/danmaku/dmmsg/danmu.go b/danmaku/dmmsg/danmu.go index 2cc5dfa..f0229d2 100644 --- a/danmaku/dmmsg/danmu.go +++ b/danmaku/dmmsg/danmu.go @@ -23,11 +23,11 @@ func (dm DanMuMessage) String() string { dm.SourceUser.Nickname, dm.SourceUser.UID, dm.Content) } -const kInvalidDanmakuJson = "invalid danmaku JSON document" +const InvalidDanmakuJson = "invalid danmaku JSON document" func ParseDanmakuMessage(body RawDanMuMessage) (dmm DanMuMessage, err error) { if len(body.Info) != 16 { - err = fmt.Errorf("%s: \"info\" length != 16", kInvalidDanmakuJson) + err = fmt.Errorf("%s: \"info\" length != 16", InvalidDanmakuJson) return } @@ -41,14 +41,14 @@ func ParseDanmakuMessage(body RawDanMuMessage) (dmm DanMuMessage, err error) { var ok bool uid, ok := userInfo[0].(float64) if !ok { - err = fmt.Errorf("%s: uid is not a float64: %v", kInvalidDanmakuJson, userInfo[0]) + err = fmt.Errorf("%s: uid is not a float64: %v", InvalidDanmakuJson, userInfo[0]) return } dmm.SourceUser.UID = int64(uid) dmm.SourceUser.Nickname, ok = userInfo[1].(string) if !ok { - err = fmt.Errorf("%s: nickname is not a string: %v", kInvalidDanmakuJson, userInfo[1]) + err = fmt.Errorf("%s: nickname is not a string: %v", InvalidDanmakuJson, userInfo[1]) return } return -- cgit v1.2.3