From 11d231fc3c674bf127088214f7ba64d5519cd3f3 Mon Sep 17 00:00:00 2001 From: "Masih H. Derkani" Date: Tue, 26 Oct 2021 15:05:33 +0100 Subject: [PATCH] Use `context.CancelFunc` instead of `func()` Where context cancellation function is referenced in struct types use existing `context.CancelFunc` to represent. Fixes #223 --- ipldutil/traverser.go | 2 +- requestmanager/client.go | 2 +- responsemanager/responsemanager_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ipldutil/traverser.go b/ipldutil/traverser.go index 2a1304d7..b45664d7 100644 --- a/ipldutil/traverser.go +++ b/ipldutil/traverser.go @@ -114,7 +114,7 @@ type traverser struct { blocksCount int parentCtx context.Context ctx context.Context - cancel func() + cancel context.CancelFunc root ipld.Link selector ipld.Node visitor traversal.AdvVisitFn diff --git a/requestmanager/client.go b/requestmanager/client.go index bc58bdb0..4e3f2cb0 100644 --- a/requestmanager/client.go +++ b/requestmanager/client.go @@ -89,7 +89,7 @@ type AsyncLoader interface { // to them. type RequestManager struct { ctx context.Context - cancel func() + cancel context.CancelFunc messages chan requestManagerMessage peerHandler PeerHandler rc *responseCollector diff --git a/responsemanager/responsemanager_test.go b/responsemanager/responsemanager_test.go index 7b7e0149..dff5c4aa 100644 --- a/responsemanager/responsemanager_test.go +++ b/responsemanager/responsemanager_test.go @@ -991,7 +991,7 @@ func (frb *fakeResponseBuilder) AddNotifee(notifee notifications.Notifee) { type testData struct { ctx context.Context t *testing.T - cancel func() + cancel context.CancelFunc blockStore map[ipld.Link][]byte persistence ipld.LinkSystem blockChainLength int