p2p/dnsdisc: using clear builtin func (#29418)

Co-authored-by: Felix Lange <fjl@twurst.com>
This commit is contained in:
cui 2024-04-04 18:19:48 +08:00 committed by GitHub
parent eea0acc549
commit 2e0c5e05ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -215,7 +215,7 @@ func TestIteratorNodeUpdates(t *testing.T) {
// Ensure RandomNode returns the new nodes after the tree is updated.
updateSomeNodes(keys, nodes)
tree2, _ := makeTestTree("n", nodes, nil)
resolver.clear()
clear(resolver)
resolver.add(tree2.ToTXT("n"))
t.Log("tree updated")
@ -256,7 +256,7 @@ func TestIteratorRootRecheckOnFail(t *testing.T) {
// Ensure RandomNode returns the new nodes after the tree is updated.
updateSomeNodes(keys, nodes)
tree2, _ := makeTestTree("n", nodes, nil)
resolver.clear()
clear(resolver)
resolver.add(tree2.ToTXT("n"))
t.Log("tree updated")
@ -447,12 +447,6 @@ func newMapResolver(maps ...map[string]string) mapResolver {
return mr
}
func (mr mapResolver) clear() {
for k := range mr {
delete(mr, k)
}
}
func (mr mapResolver) add(m map[string]string) {
maps.Copy(mr, m)
}