Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

fix staticcheck #474

Merged
merged 1 commit into from
Apr 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions bitswap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
deciface "github.com/ipfs/go-bitswap/decision"
decision "github.com/ipfs/go-bitswap/internal/decision"
bssession "github.com/ipfs/go-bitswap/internal/session"
"github.com/ipfs/go-bitswap/message"
bsmsg "github.com/ipfs/go-bitswap/message"
pb "github.com/ipfs/go-bitswap/message/pb"
testinstance "github.com/ipfs/go-bitswap/testinstance"
Expand Down Expand Up @@ -149,7 +148,7 @@ func TestUnwantedBlockNotAdded(t *testing.T) {

net := tn.VirtualNetwork(mockrouting.NewServer(), delay.Fixed(kNetworkDelay))
block := blocks.NewBlock([]byte("block"))
bsMessage := message.New(true)
bsMessage := bsmsg.New(true)
bsMessage.AddBlock(block)

ig := testinstance.NewTestInstanceGenerator(net, nil, nil)
Expand Down Expand Up @@ -215,7 +214,7 @@ func TestPendingBlockAdded(t *testing.T) {

// Simulate receiving a message which contains the block in the "tofetch" queue
lastBlock := blks[len(blks)-1]
bsMessage := message.New(true)
bsMessage := bsmsg.New(true)
bsMessage.AddBlock(lastBlock)
unknownPeer := peer.ID("QmUHfvCQrzyR6vFXmeyCptfCWedfcmfa12V6UuziDtrw23")
instance.Exchange.ReceiveMessage(oneSecCtx, unknownPeer, bsMessage)
Expand Down
3 changes: 1 addition & 2 deletions internal/decision/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,9 @@ func peerIsPartner(p peer.ID, e *Engine) bool {
}

func TestOutboxClosedWhenEngineClosed(t *testing.T) {
ctx := context.Background()
t.SkipNow() // TODO implement *Engine.Close
e := newEngine(blockstore.NewBlockstore(dssync.MutexWrap(ds.NewMapDatastore())), 4, &fakePeerTagger{}, "localhost", 0, NewTestScoreLedger(shortTerm, nil))
e.StartWorkers(ctx, process.WithTeardown(func() error { return nil }))
e.StartWorkers(context.Background(), process.WithTeardown(func() error { return nil }))
var wg sync.WaitGroup
wg.Add(1)
go func() {
Expand Down
3 changes: 1 addition & 2 deletions internal/messagequeue/messagequeue.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
bsmsg "github.com/ipfs/go-bitswap/message"
pb "github.com/ipfs/go-bitswap/message/pb"
bsnet "github.com/ipfs/go-bitswap/network"
"github.com/ipfs/go-bitswap/wantlist"
bswl "github.com/ipfs/go-bitswap/wantlist"
cid "github.com/ipfs/go-cid"
logging "github.com/ipfs/go-log"
Expand Down Expand Up @@ -142,7 +141,7 @@ func (r *recallWantlist) RemoveType(c cid.Cid, wtype pb.Message_Wantlist_WantTyp
//
// Returns true if the want was marked as sent. Returns false if the want wasn't
// pending.
func (r *recallWantlist) MarkSent(e wantlist.Entry) bool {
func (r *recallWantlist) MarkSent(e bswl.Entry) bool {
if !r.pending.RemoveType(e.Cid, e.WantType) {
return false
}
Expand Down
3 changes: 1 addition & 2 deletions internal/messagequeue/messagequeue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"time"

"github.com/ipfs/go-bitswap/internal/testutil"
"github.com/ipfs/go-bitswap/message"
pb "github.com/ipfs/go-bitswap/message/pb"
cid "github.com/ipfs/go-cid"

Expand Down Expand Up @@ -251,7 +250,7 @@ func TestSendingMessagesPriority(t *testing.T) {
if totalEntriesLength(messages) != len(wantHaves)+len(wantBlocks) {
t.Fatal("wrong number of wants")
}
byCid := make(map[cid.Cid]message.Entry)
byCid := make(map[cid.Cid]bsmsg.Entry)
for _, entry := range messages[0] {
byCid[entry.Cid] = entry
}
Expand Down
6 changes: 3 additions & 3 deletions network/ipfs_impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (r *receiver) PeerDisconnected(p peer.ID) {
r.connectionEvent <- false
}

var mockNetErr = fmt.Errorf("network err")
var errMockNetErr = fmt.Errorf("network err")

type ErrStream struct {
network.Stream
Expand Down Expand Up @@ -115,7 +115,7 @@ func (eh *ErrHost) NewStream(ctx context.Context, p peer.ID, pids ...protocol.ID
defer eh.lk.Unlock()

if eh.err != nil {
return nil, mockNetErr
return nil, errMockNetErr
}
if eh.timingOut {
return nil, context.DeadlineExceeded
Expand Down Expand Up @@ -337,7 +337,7 @@ func TestMessageResendAfterError(t *testing.T) {

// Return an error from the networking layer the next time we try to send
// a message
eh.setError(mockNetErr)
eh.setError(errMockNetErr)

go func() {
time.Sleep(testSendErrorBackoff / 2)
Expand Down