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/client.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'danmaku/client.go') diff --git a/danmaku/client.go b/danmaku/client.go index 3a1298d..b785e23 100644 --- a/danmaku/client.go +++ b/danmaku/client.go @@ -15,8 +15,8 @@ import ( "nhooyr.io/websocket" ) -// Bilibili uses only binary WebSocket messages -const kBilibiliWebSocketMessageType = websocket.MessageBinary +// BilibiliWebSocketMessageType Bilibili uses only binary WebSocket messages +const BilibiliWebSocketMessageType = websocket.MessageBinary type DanmakuClient struct { ws *websocket.Conn @@ -34,7 +34,7 @@ type wsDatagramIO struct { } func (w *wsDatagramIO) Consume(data []byte) error { - return w.ws.Write(w.ctx, kBilibiliWebSocketMessageType, data) + return w.ws.Write(w.ctx, BilibiliWebSocketMessageType, data) } func (w *wsDatagramIO) Get() (data []byte, err error) { @@ -42,7 +42,7 @@ func (w *wsDatagramIO) Get() (data []byte, err error) { if err != nil { return } - if typ != kBilibiliWebSocketMessageType { + if typ != BilibiliWebSocketMessageType { err = fmt.Errorf("invalid message type: expected a binary WebSocket message, however got %v", typ.String()) } return -- cgit v1.2.3