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) }