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