Skip to content

Commit cfe7b24

Browse files
committed
Use maps.Clone
Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent 6f76129 commit cfe7b24

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

fs/blkio_test.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package fs
22

33
import (
4+
"maps"
45
"strconv"
56
"testing"
67

@@ -465,10 +466,7 @@ func TestBlkioStatsNoFilesBFQDebug(t *testing.T) {
465466
for _, testCase := range testCases {
466467
path := tempDir(t, "cpuset")
467468

468-
tempBlkioTestFiles := map[string]string{}
469-
for i, v := range blkioBFQDebugStatsTestFiles {
470-
tempBlkioTestFiles[i] = v
471-
}
469+
tempBlkioTestFiles := maps.Clone(blkioBFQDebugStatsTestFiles)
472470
delete(tempBlkioTestFiles, testCase.filename)
473471

474472
writeFileContents(t, path, tempBlkioTestFiles)
@@ -579,10 +577,7 @@ func TestBlkioStatsNoFilesCFQ(t *testing.T) {
579577
for _, testCase := range testCases {
580578
path := tempDir(t, "cpuset")
581579

582-
tempBlkioTestFiles := map[string]string{}
583-
for i, v := range blkioCFQStatsTestFiles {
584-
tempBlkioTestFiles[i] = v
585-
}
580+
tempBlkioTestFiles := maps.Clone(blkioCFQStatsTestFiles)
586581
delete(tempBlkioTestFiles, testCase.filename)
587582

588583
writeFileContents(t, path, tempBlkioTestFiles)

fs/cpuset_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package fs
22

33
import (
4+
"maps"
45
"reflect"
56
"testing"
67

@@ -211,10 +212,7 @@ func TestCPUSetStatsMissingFiles(t *testing.T) {
211212
t.Run(testCase.desc, func(t *testing.T) {
212213
path := tempDir(t, "cpuset")
213214

214-
tempCpusetTestFiles := map[string]string{}
215-
for i, v := range cpusetTestFiles {
216-
tempCpusetTestFiles[i] = v
217-
}
215+
tempCpusetTestFiles := maps.Clone(cpusetTestFiles)
218216

219217
if testCase.removeFile {
220218
delete(tempCpusetTestFiles, testCase.filename)

0 commit comments

Comments
 (0)