From b1e47218ea129e225f5473f9928e814e24112f01 Mon Sep 17 00:00:00 2001
From: rht <rhtbot@gmail.com>
Date: Sun, 23 Aug 2015 22:12:23 +0700
Subject: [PATCH] Localize the scope of context.WithCancel for every DAG.Get

Instead put it inside of DAG.Get.
The fix is applied only in the case when the context.WithCancel
before a DAG.Get is also used later on in the scope.

License: MIT
Signed-off-by: rht <rhtbot@gmail.com>
---
 pin.go | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/pin.go b/pin.go
index 8f2d4b8..3d51b7a 100644
--- a/pin.go
+++ b/pin.go
@@ -106,8 +106,7 @@ func (p *pinner) Pin(ctx context.Context, node *mdag.Node, recurse bool) error {
 
 		p.recursePin.AddBlock(k)
 	} else {
-		_, err := p.dserv.Get(ctx, k)
-		if err != nil {
+		if _, err := p.dserv.Get(ctx, k); err != nil {
 			return err
 		}
 
-- 
GitLab