projects/guix·blob python-team · refs

137 lines · 3.0 KiB

1Retrieved from
2<https://patch-diff.githubusercontent.com/raw/jbenet/go-context/pull/3.patch>.
3
4From a55d3832cfe7bb061123c7e90ed3c6195d8ce890 Mon Sep 17 00:00:00 2001
5From: Prudhvi Surapaneni <[email protected]>
6Date: Wed, 13 Mar 2019 16:29:55 -0500
7Subject: [PATCH] No-longer necessary to import context package
8
9---
10 dag/dagctx.go | 3 +--
11 dag/dagctx_test.go | 3 +--
12 frac/fracctx.go | 3 +--
13 frac/fracctx_test.go | 12 +++++++-----
14 io/ctxio.go | 3 +--
15 io/ctxio_test.go | 3 +--
16 6 files changed, 12 insertions(+), 15 deletions(-)
17
18diff --git a/dag/dagctx.go b/dag/dagctx.go
19index 521390b..17a9090 100644
20--- a/dag/dagctx.go
21+++ b/dag/dagctx.go
22@@ -1,10 +1,9 @@
23 package ctxext
24
25 import (
26+ "context"
27 "sync"
28 "time"
29-
30- context "golang.org/x/net/context"
31 )
32
33 // WithParents returns a Context that listens to all given
34diff --git a/dag/dagctx_test.go b/dag/dagctx_test.go
35index 30a27e2..8692f54 100644
36--- a/dag/dagctx_test.go
37+++ b/dag/dagctx_test.go
38@@ -1,11 +1,10 @@
39 package ctxext
40
41 import (
42+ "context"
43 "math/rand"
44 "testing"
45 "time"
46-
47- context "golang.org/x/net/context"
48 )
49
50 func TestWithParentsSingle(t *testing.T) {
51diff --git a/frac/fracctx.go b/frac/fracctx.go
52index 60938c0..d1ee94a 100644
53--- a/frac/fracctx.go
54+++ b/frac/fracctx.go
55@@ -2,9 +2,8 @@
56 package ctxext
57
58 import (
59+ "context"
60 "time"
61-
62- context "golang.org/x/net/context"
63 )
64
65 // WithDeadlineFraction returns a Context with a fraction of the
66diff --git a/frac/fracctx_test.go b/frac/fracctx_test.go
67index c6dd10d..8de81be 100644
68--- a/frac/fracctx_test.go
69+++ b/frac/fracctx_test.go
70@@ -1,11 +1,10 @@
71 package ctxext
72
73 import (
74+ "context"
75 "os"
76 "testing"
77 "time"
78-
79- context "golang.org/x/net/context"
80 )
81
82 // this test is on the context tool itself, not our stuff. it's for sanity on ours.
83@@ -14,7 +13,8 @@ func TestDeadline(t *testing.T) {
84 t.Skip("timeouts don't work reliably on travis")
85 }
86
87- ctx, _ := context.WithTimeout(context.Background(), 5*time.Millisecond)
88+ ctx, cncl := context.WithTimeout(context.Background(), 5*time.Millisecond)
89+ defer cncl()
90
91 select {
92 case <-ctx.Done():
93@@ -46,8 +46,10 @@ func TestDeadlineFractionHalf(t *testing.T) {
94 t.Skip("timeouts don't work reliably on travis")
95 }
96
97- ctx1, _ := context.WithTimeout(context.Background(), 10*time.Millisecond)
98- ctx2, _ := WithDeadlineFraction(ctx1, 0.5)
99+ ctx1, cncl1 := context.WithTimeout(context.Background(), 10*time.Millisecond)
100+ defer cncl1()
101+ ctx2, cncl2 := WithDeadlineFraction(ctx1, 0.5)
102+ defer cncl2()
103
104 select {
105 case <-ctx1.Done():
106diff --git a/io/ctxio.go b/io/ctxio.go
107index b4f2454..b27689b 100644
108--- a/io/ctxio.go
109+++ b/io/ctxio.go
110@@ -11,9 +11,8 @@
111 package ctxio
112
113 import (
114+ "context"
115 "io"
116-
117- context "golang.org/x/net/context"
118 )
119
120 type ioret struct {
121diff --git a/io/ctxio_test.go b/io/ctxio_test.go
122index 884e090..bc4a0e9 100644
123--- a/io/ctxio_test.go
124+++ b/io/ctxio_test.go
125@@ -2,11 +2,10 @@ package ctxio
126
127 import (
128 "bytes"
129+ "context"
130 "io"
131 "testing"
132 "time"
133-
134- context "golang.org/x/net/context"
135 )
136
137 func TestReader(t *testing.T) {