mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-08 09:14:40 +00:00
net/netcheck: remove unnecessary custom map clone function
Updates #8419 Updates #cleanup Signed-off-by: James Tucker <james@tailscale.com>
This commit is contained in:
parent
6df5c8f32e
commit
606f7ef2c6
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user