From 5e81c24c13b161b088af254ada651561fbca6a81 Mon Sep 17 00:00:00 2001 From: galargh Date: Mon, 5 Aug 2024 19:51:38 +0200 Subject: [PATCH] chore: staticcheck --- floodsub_test.go | 1 + gossipsub_spam_test.go | 1 + gossipsub_test.go | 9 +++------ timecache/time_cache.go | 4 ---- topic_test.go | 2 +- trace_test.go | 1 + tracer.go | 1 + 7 files changed, 8 insertions(+), 11 deletions(-) diff --git a/floodsub_test.go b/floodsub_test.go index 8a2db35b..7d3cd0ee 100644 --- a/floodsub_test.go +++ b/floodsub_test.go @@ -21,6 +21,7 @@ import ( "github.com/libp2p/go-libp2p/core/peer" "github.com/libp2p/go-libp2p/core/protocol" + //lint:ignore SA1019 "github.com/libp2p/go-msgio/protoio" ) diff --git a/gossipsub_spam_test.go b/gossipsub_spam_test.go index 8e9b40e3..6567e758 100644 --- a/gossipsub_spam_test.go +++ b/gossipsub_spam_test.go @@ -15,6 +15,7 @@ import ( pb "github.com/libp2p/go-libp2p-pubsub/pb" + //lint:ignore SA1019 "github.com/libp2p/go-msgio/protoio" ) diff --git a/gossipsub_test.go b/gossipsub_test.go index d4a8a79d..03c8f9ef 100644 --- a/gossipsub_test.go +++ b/gossipsub_test.go @@ -20,6 +20,7 @@ import ( "github.com/libp2p/go-libp2p/core/peerstore" "github.com/libp2p/go-libp2p/core/record" + //lint:ignore SA1019 "github.com/libp2p/go-msgio/protoio" ) @@ -1924,13 +1925,11 @@ func TestGossipSubLeaveTopic(t *testing.T) { connect(t, h[0], h[1]) // Join all peers - var subs []*Subscription for _, ps := range psubs { - sub, err := ps.Subscribe("test") + _, err := ps.Subscribe("test") if err != nil { t.Fatal(err) } - subs = append(subs, sub) } time.Sleep(time.Second) @@ -2005,13 +2004,11 @@ func TestGossipSubJoinTopic(t *testing.T) { router0.backoff["test"] = peerMap // Join all peers - var subs []*Subscription for _, ps := range psubs { - sub, err := ps.Subscribe("test") + _, err := ps.Subscribe("test") if err != nil { t.Fatal(err) } - subs = append(subs, sub) } time.Sleep(time.Second) diff --git a/timecache/time_cache.go b/timecache/time_cache.go index e33bc354..ee34fd5b 100644 --- a/timecache/time_cache.go +++ b/timecache/time_cache.go @@ -2,12 +2,8 @@ package timecache import ( "time" - - logger "github.com/ipfs/go-log/v2" ) -var log = logger.Logger("pubsub/timecache") - // Stategy is the TimeCache expiration strategy to use. type Strategy uint8 diff --git a/topic_test.go b/topic_test.go index a27113b2..ef05feb4 100644 --- a/topic_test.go +++ b/topic_test.go @@ -743,7 +743,7 @@ func notifSubThenUnSub(ctx context.Context, t *testing.T, topics []*Topic) { } // Wait for the unsubscribe messages to reach the primary peer - for len(primaryTopic.ListPeers()) < 0 { + for len(primaryTopic.ListPeers()) > 0 { time.Sleep(time.Millisecond * 100) } diff --git a/trace_test.go b/trace_test.go index 7717a7e2..8c77e985 100644 --- a/trace_test.go +++ b/trace_test.go @@ -17,6 +17,7 @@ import ( "github.com/libp2p/go-libp2p/core/peer" "github.com/libp2p/go-libp2p/core/peerstore" + //lint:ignore SA1019 "github.com/libp2p/go-msgio/protoio" ) diff --git a/tracer.go b/tracer.go index 8e744c91..c9dcab9d 100644 --- a/tracer.go +++ b/tracer.go @@ -17,6 +17,7 @@ import ( "github.com/libp2p/go-libp2p/core/peerstore" "github.com/libp2p/go-libp2p/core/protocol" + //lint:ignore SA1019 "github.com/libp2p/go-msgio/protoio" )