refactor: run Go modernize
Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
|||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
|
"maps"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"os"
|
"os"
|
||||||
@@ -594,9 +595,7 @@ func (t *testableWebSocketService) getConnectionCount() int {
|
|||||||
func (t *testableWebSocketService) closeAllConnections() {
|
func (t *testableWebSocketService) closeAllConnections() {
|
||||||
t.mu.Lock()
|
t.mu.Lock()
|
||||||
conns := make(map[string]*wsConnection, len(t.connections))
|
conns := make(map[string]*wsConnection, len(t.connections))
|
||||||
for k, v := range t.connections {
|
maps.Copy(conns, t.connections)
|
||||||
conns[k] = v
|
|
||||||
}
|
|
||||||
t.connections = make(map[string]*wsConnection)
|
t.connections = make(map[string]*wsConnection)
|
||||||
t.mu.Unlock()
|
t.mu.Unlock()
|
||||||
|
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ var _ = Describe("purgeCacheBySize", func() {
|
|||||||
now := time.Now()
|
now := time.Now()
|
||||||
|
|
||||||
// Create 5 files, 1MiB each (total 5MiB)
|
// 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"))
|
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))
|
createFileWithSize(path, 1*1024*1024, now.Add(-time.Duration(5-i)*time.Hour))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user