diff options
author | Keuin <[email protected]> | 2023-07-01 22:10:22 +0800 |
---|---|---|
committer | Keuin <[email protected]> | 2023-07-01 22:10:44 +0800 |
commit | b8d0d0c3b6b2ffe40921aa4c247c101dd0ce958d (patch) | |
tree | c14f512312a6ee2fab6bdaef7cb55dfedbf19262 /danmaku/dmmsg/danmu.go | |
parent | 8f07f6f4d7e91a9e4b7164a39759907fac5fb8a1 (diff) |
Refactor: rename consts to follow Go idiom. Fix const comment style.
Diffstat (limited to 'danmaku/dmmsg/danmu.go')
-rw-r--r-- | danmaku/dmmsg/danmu.go | 8 |
1 files changed, 4 insertions, 4 deletions
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 |