Code formatting: declare writer and reader on the same line

This commit is contained in:
Kelvin Clement Mwinuka
2024-01-23 23:58:09 +08:00
parent 4b980cc5fd
commit 7e55fd469b
2 changed files with 3 additions and 6 deletions

View File

@@ -40,8 +40,7 @@ func (cg *ConsumerGroup) SendMessage(message string) {
cg.subscribersRWMut.RUnlock()
w := io.Writer(*conn)
r := io.Reader(*conn)
w, r := io.Writer(*conn), io.Reader(*conn)
if _, err := w.Write([]byte(fmt.Sprintf("$%d\r\n%s\r\n\n", len(message), message))); err != nil {
// TODO: Log error at configured logger
@@ -168,8 +167,7 @@ func (ch *Channel) Start() {
for _, conn := range ch.subscribers {
go func(conn *net.Conn) {
w := io.Writer(*conn)
r := io.Reader(*conn)
w, r := io.Writer(*conn), io.Reader(*conn)
if _, err := w.Write([]byte(fmt.Sprintf("$%d\r\n%s\r\n\r\n", len(message), message))); err != nil {
// TODO: Log error at configured logger

View File

@@ -84,8 +84,7 @@ func (server *Server) StartTCP(ctx context.Context) {
func (server *Server) handleConnection(ctx context.Context, conn net.Conn) {
server.ACL.RegisterConnection(&conn)
w := io.Writer(conn)
r := io.Reader(conn)
w, r := io.Writer(conn), io.Reader(conn)
cid := server.ConnID.Add(1)
ctx = context.WithValue(ctx, utils.ContextConnID("ConnectionID"),