From 606f7ef2c6823de8047f742fa28f1961b199e382 Mon Sep 17 00:00:00 2001 From: James Tucker Date: Fri, 14 Feb 2025 17:15:20 -0800 Subject: [PATCH] net/netcheck: remove unnecessary custom map clone function Updates #8419 Updates #cleanup Signed-off-by: James Tucker --- net/netcheck/netcheck.go | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/net/netcheck/netcheck.go b/net/netcheck/netcheck.go index c32eeee8b..107573e5d 100644 --- a/net/netcheck/netcheck.go +++ b/net/netcheck/netcheck.go @@ -172,25 +172,14 @@ func (r *Report) Clone() *Report { return nil } r2 := *r - r2.RegionLatency = cloneDurationMap(r2.RegionLatency) - r2.RegionV4Latency = cloneDurationMap(r2.RegionV4Latency) - r2.RegionV6Latency = cloneDurationMap(r2.RegionV6Latency) + r2.RegionLatency = maps.Clone(r2.RegionLatency) + r2.RegionV4Latency = maps.Clone(r2.RegionV4Latency) + r2.RegionV6Latency = maps.Clone(r2.RegionV6Latency) r2.GlobalV4Counters = maps.Clone(r2.GlobalV4Counters) r2.GlobalV6Counters = maps.Clone(r2.GlobalV6Counters) return &r2 } -func cloneDurationMap(m map[int]time.Duration) map[int]time.Duration { - if m == nil { - return nil - } - m2 := make(map[int]time.Duration, len(m)) - for k, v := range m { - m2[k] = v - } - return m2 -} - // Client generates Reports describing the result of both passive and active // network configuration probing. It provides two different modes of report, a // full report (see MakeNextReportFull) and a more lightweight incremental