From 36211ef5f15afdbd848a887335808bb1fbbd4c02 Mon Sep 17 00:00:00 2001 From: Daniel Liu Date: Thu, 31 Oct 2024 14:55:09 +0800 Subject: [PATCH] p2p/netutil: fix staticcheck warning SA1021: not use bytes.Equal to compare net.IPs --- p2p/netutil/net.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/p2p/netutil/net.go b/p2p/netutil/net.go index 656abb6825..d5da3c694f 100644 --- a/p2p/netutil/net.go +++ b/p2p/netutil/net.go @@ -212,7 +212,7 @@ func sameNet(bits uint, ip, other net.IP) bool { if mask != 0 && nb < len(ip) && ip[nb]&mask != other[nb]&mask { return false } - return nb <= len(ip) && bytes.Equal(ip[:nb], other[:nb]) + return nb <= len(ip) && ip[:nb].Equal(other[:nb]) } // DistinctNetSet tracks IPs, ensuring that at most N of them