From 1916fbce28941552928c51e40b489ed1abe86a68 Mon Sep 17 00:00:00 2001 From: link1st <562117637@qq.com> Date: Wed, 12 Jun 2024 10:26:18 +0800 Subject: [PATCH] optimize code --- servers/websocket/client_manager.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/servers/websocket/client_manager.go b/servers/websocket/client_manager.go index 2c52d1d..75a1694 100644 --- a/servers/websocket/client_manager.go +++ b/servers/websocket/client_manager.go @@ -138,7 +138,7 @@ func (manager *ClientManager) DelUsers(client *Client) (result bool) { // GetUserKeys 获取用户的key func (manager *ClientManager) GetUserKeys() (userKeys []string) { - userKeys = make([]string, len(manager.Users)) + userKeys = make([]string, 0, len(manager.Users)) for key := range manager.Users { userKeys = append(userKeys, key) }