From a8a525282cdfa4ce2017ad1b3b4758c81e23cb6f Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Tue, 27 Feb 2024 20:01:59 -0800 Subject: [PATCH] wgengine: use slices.Clone in two places Updates #cleanup Change-Id: I1cb30efb6d09180e82b807d6146f37897ef99307 Signed-off-by: Brad Fitzpatrick --- wgengine/userspace.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wgengine/userspace.go b/wgengine/userspace.go index f50b5ade3..363ffbb45 100644 --- a/wgengine/userspace.go +++ b/wgengine/userspace.go @@ -13,6 +13,7 @@ "math" "net/netip" "runtime" + "slices" "strings" "sync" "time" @@ -1040,9 +1041,8 @@ func (e *userspaceEngine) getStatus() (*Status, error) { e.mu.Lock() closing := e.closing - peerKeys := make([]key.NodePublic, len(e.peerSequence)) - copy(peerKeys, e.peerSequence) - localAddrs := append([]tailcfg.Endpoint(nil), e.endpoints...) + peerKeys := slices.Clone(e.peerSequence) + localAddrs := slices.Clone(e.endpoints) e.mu.Unlock() if closing {