From 179650d33515a758a2010e8b3b20617612b58bce Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Wed, 2 Sep 2020 15:54:41 -0700 Subject: [PATCH] fix: update to go 1.15 lint warnings --- internal/sessionmanager/sessionmanager_test.go | 9 +++++---- internal/testutil/testutil.go | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/internal/sessionmanager/sessionmanager_test.go b/internal/sessionmanager/sessionmanager_test.go index db88855..8025bd5 100644 --- a/internal/sessionmanager/sessionmanager_test.go +++ b/internal/sessionmanager/sessionmanager_test.go @@ -2,6 +2,7 @@ package sessionmanager import ( "context" + "fmt" "sync" "testing" "time" @@ -118,7 +119,7 @@ func TestReceiveFrom(t *testing.T) { pm := &fakePeerManager{} sm := New(ctx, sessionFactory, sim, peerManagerFactory, bpm, pm, notif, "") - p := peer.ID(123) + p := peer.ID(fmt.Sprint(123)) block := blocks.NewBlock([]byte("block")) firstSession := sm.NewSession(ctx, time.Second, delay.Fixed(time.Minute)).(*fakeSession) @@ -165,7 +166,7 @@ func TestReceiveBlocksWhenManagerShutdown(t *testing.T) { pm := &fakePeerManager{} sm := New(ctx, sessionFactory, sim, peerManagerFactory, bpm, pm, notif, "") - p := peer.ID(123) + p := peer.ID(fmt.Sprint(123)) block := blocks.NewBlock([]byte("block")) firstSession := sm.NewSession(ctx, time.Second, delay.Fixed(time.Minute)).(*fakeSession) @@ -199,7 +200,7 @@ func TestReceiveBlocksWhenSessionContextCancelled(t *testing.T) { pm := &fakePeerManager{} sm := New(ctx, sessionFactory, sim, peerManagerFactory, bpm, pm, notif, "") - p := peer.ID(123) + p := peer.ID(fmt.Sprint(123)) block := blocks.NewBlock([]byte("block")) firstSession := sm.NewSession(ctx, time.Second, delay.Fixed(time.Minute)).(*fakeSession) @@ -235,7 +236,7 @@ func TestShutdown(t *testing.T) { pm := &fakePeerManager{} sm := New(ctx, sessionFactory, sim, peerManagerFactory, bpm, pm, notif, "") - p := peer.ID(123) + p := peer.ID(fmt.Sprint(123)) block := blocks.NewBlock([]byte("block")) cids := []cid.Cid{block.Cid()} firstSession := sm.NewSession(ctx, time.Second, delay.Fixed(time.Minute)).(*fakeSession) diff --git a/internal/testutil/testutil.go b/internal/testutil/testutil.go index 48af8a7..6b9fc6f 100644 --- a/internal/testutil/testutil.go +++ b/internal/testutil/testutil.go @@ -1,6 +1,7 @@ package testutil import ( + "fmt" "math/rand" bsmsg "github.com/ipfs/go-bitswap/message" @@ -59,7 +60,7 @@ func GeneratePeers(n int) []peer.ID { peerIds := make([]peer.ID, 0, n) for i := 0; i < n; i++ { peerSeq++ - p := peer.ID(peerSeq) + p := peer.ID(fmt.Sprint(i)) peerIds = append(peerIds, p) } return peerIds -- GitLab