From c280dd67a4f4e2141f49f3bfec6d5d52de85b4f0 Mon Sep 17 00:00:00 2001 From: Deluan Date: Mon, 9 Feb 2026 08:44:44 -0500 Subject: [PATCH] refactor: run Go modernize Signed-off-by: Deluan --- plugins/host_websocket_test.go | 5 ++--- plugins/manager_cache_test.go | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/host_websocket_test.go b/plugins/host_websocket_test.go index d359ff27e..a3d8ee74a 100644 --- a/plugins/host_websocket_test.go +++ b/plugins/host_websocket_test.go @@ -7,6 +7,7 @@ import ( "crypto/sha256" "encoding/base64" "encoding/hex" + "maps" "net/http" "net/http/httptest" "os" @@ -594,9 +595,7 @@ func (t *testableWebSocketService) getConnectionCount() int { func (t *testableWebSocketService) closeAllConnections() { t.mu.Lock() conns := make(map[string]*wsConnection, len(t.connections)) - for k, v := range t.connections { - conns[k] = v - } + maps.Copy(conns, t.connections) t.connections = make(map[string]*wsConnection) t.mu.Unlock() diff --git a/plugins/manager_cache_test.go b/plugins/manager_cache_test.go index 9411f767b..f985fcd84 100644 --- a/plugins/manager_cache_test.go +++ b/plugins/manager_cache_test.go @@ -142,7 +142,7 @@ var _ = Describe("purgeCacheBySize", func() { now := time.Now() // Create 5 files, 1MiB each (total 5MiB) - for i := 0; i < 5; i++ { + for i := range 5 { path := filepath.Join(cacheDir, filepath.Join("dir", "file"+string(rune('0'+i))+".bin")) createFileWithSize(path, 1*1024*1024, now.Add(-time.Duration(5-i)*time.Hour)) }