Replace maps.Clear with builtin clear; fix appendAssign in test

This commit is contained in:
Viktor Liu
2026-05-04 12:34:08 +02:00
parent 5ba9882fd4
commit b828b2bf88
3 changed files with 7 additions and 7 deletions

View File

@@ -20,7 +20,6 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/go-multierror"
log "github.com/sirupsen/logrus"
"golang.org/x/exp/maps"
nberrors "github.com/netbirdio/netbird/client/errors"
firewall "github.com/netbirdio/netbird/client/firewall/manager"
@@ -675,10 +674,10 @@ func (m *Manager) Flush() error { return nil }
// resetState clears all firewall rules and closes connection trackers.
// Must be called with m.mutex held.
func (m *Manager) resetState() {
maps.Clear(m.outgoingRules)
maps.Clear(m.incomingDenyRules)
maps.Clear(m.incomingRules)
maps.Clear(m.routeRulesMap)
clear(m.outgoingRules)
clear(m.incomingDenyRules)
clear(m.incomingRules)
clear(m.routeRulesMap)
m.routeRules = m.routeRules[:0]
m.udpHookOut.Store(nil)
m.tcpHookOut.Store(nil)

View File

@@ -67,7 +67,8 @@ func TestParseICMPv6_SingleExtension(t *testing.T) {
src := netip.MustParseAddr("fd00::1")
dst := netip.MustParseAddr("fd00::2")
hbh := extHdr(t, uint8(header.ICMPv6ProtocolNumber), 8)
payload := append(hbh, echoRequest()...)
payload := append([]byte{}, hbh...)
payload = append(payload, echoRequest()...)
pkt := makeIPv6(t, src, dst, uint8(header.IPv6HopByHopOptionsExtHdrIdentifier), payload)
off, icmpLen, _, _, ok := parseICMPv6(pkt)

View File

@@ -410,7 +410,7 @@ func (s *DefaultServer) Stop() {
log.Errorf("failed to disable DNS: %v", err)
}
maps.Clear(s.extraDomains)
clear(s.extraDomains)
}
func (s *DefaultServer) disableDNS() (retErr error) {