@cryptotaxi247 / kubo / commits / 7a6febbe3

godeps: following up on PR #1098 to drop the facebookgo code

I want to follow this up with a thorough execution of my x/tool/cmd/eg experiments (https://github.com/ipfs/go-ipfs/compare/errRampage)

Henry committed Apr 28, 2015 at 13:00 UTC 7a6febbe38c6f70af77b45469affaf367f2909f0
15 files changed +13 -582
Godeps/Godeps.json
-8
@@ -77,14 +77,6 @@
77 "ImportPath": "github.com/facebookgo/atomicfile",
78 "Rev": "6f117f2e7f224fb03eb5e5fba370eade6e2b90c8"
79 },
80 - {
81 - "ImportPath": "github.com/facebookgo/stack",
82 - "Rev": "4da6d991fc3c389efa512151354d643eb5fae4e2"
83 - },
84 - {
85 - "ImportPath": "github.com/facebookgo/stackerr",
86 - "Rev": "060fbf9364c89acd41bf710e9e92915a90e7a5b5"
87 - },
80 {
81 "ImportPath": "github.com/fd/go-nat",
82 "Rev": "50e7633d5f27d81490026a13e5b92d2e42d8c6bb"
Godeps/_workspace/src/github.com/facebookgo/stack/.travis.yml deleted
-24
@@ -1,24 +0,0 @@
1 -language: go
2 -
3 -go:
4 - - 1.2
5 - - 1.3
6 -
7 -matrix:
8 - fast_finish: true
9 -
10 -before_install:
11 - - go get -v code.google.com/p/go.tools/cmd/vet
12 - - go get -v github.com/golang/lint/golint
13 - - go get -v code.google.com/p/go.tools/cmd/cover
14 -
15 -install:
16 - - go install -race -v std
17 - - go get -race -t -v ./...
18 - - go install -race -v ./...
19 -
20 -script:
21 - - go vet ./...
22 - - $HOME/gopath/bin/golint .
23 - - go test -cpu=2 -race -v ./...
24 - - go test -cpu=2 -covermode=atomic ./...
Godeps/_workspace/src/github.com/facebookgo/stack/readme.md deleted
-4
@@ -1,4 +0,0 @@
1 -stack [![Build Status](https://secure.travis-ci.org/facebookgo/stack.png)](http://travis-ci.org/facebookgo/stack)
2 -=====
3 -
4 -Documentation: https://godoc.org/github.com/facebookgo/stack
Godeps/_workspace/src/github.com/facebookgo/stack/stack.go deleted
-197
@@ -1,197 +0,0 @@
1 -// Package stack provides utilities to capture and pass around stack traces.
2 -//
3 -// This is useful for building errors that know where they originated from, to
4 -// track where a certain log event occured and so on.
5 -package stack
6 -
7 -import (
8 - "bytes"
9 - "fmt"
10 - "os"
11 - "path/filepath"
12 - "runtime"
13 - "strings"
14 -)
15 -
16 -const maxStackSize = 32
17 -
18 -// Frame identifies a file, line & function name in the stack.
19 -type Frame struct {
20 - File string
21 - Line int
22 - Name string
23 -}
24 -
25 -// String provides the standard file:line representation.
26 -func (f Frame) String() string {
27 - return fmt.Sprintf("%s:%d %s", f.File, f.Line, f.Name)
28 -}
29 -
30 -// Stack represents an ordered set of Frames.
31 -type Stack []Frame
32 -
33 -// String provides the standard multi-line stack trace.
34 -func (s Stack) String() string {
35 - var b bytes.Buffer
36 - writeStack(&b, s)
37 - return b.String()
38 -}
39 -
40 -// Multi represents a number of Stacks. This is useful to allow tracking a
41 -// value as it travels thru code.
42 -type Multi struct {
43 - stacks []Stack
44 -}
45 -
46 -// Stacks returns the tracked Stacks.
47 -func (m *Multi) Stacks() []Stack {
48 - return m.stacks
49 -}
50 -
51 -// Add the given Stack to this Multi.
52 -func (m *Multi) Add(s Stack) {
53 - m.stacks = append(m.stacks, s)
54 -}
55 -
56 -// AddCallers adds the Callers Stack to this Multi. The argument skip is
57 -// the number of stack frames to ascend, with 0 identifying the caller of
58 -// Callers.
59 -func (m *Multi) AddCallers(skip int) {
60 - m.Add(Callers(skip + 1))
61 -}
62 -
63 -// String provides a human readable multi-line stack trace.
64 -func (m *Multi) String() string {
65 - var b bytes.Buffer
66 - for i, s := range m.stacks {
67 - if i != 0 {
68 - fmt.Fprintf(&b, "\n(Stack %d)\n", i+1)
69 - }
70 - writeStack(&b, s)
71 - }
72 - return b.String()
73 -}
74 -
75 -// Caller returns a single Frame for the caller. The argument skip is the
76 -// number of stack frames to ascend, with 0 identifying the caller of Callers.
77 -func Caller(skip int) Frame {
78 - pc, file, line, _ := runtime.Caller(skip + 1)
79 - fun := runtime.FuncForPC(pc)
80 - return Frame{
81 - File: StripGOPATH(file),
82 - Line: line,
83 - Name: StripPackage(fun.Name()),
84 - }
85 -}
86 -
87 -// Callers returns a Stack of Frames for the callers. The argument skip is the
88 -// number of stack frames to ascend, with 0 identifying the caller of Callers.
89 -func Callers(skip int) Stack {
90 - pcs := make([]uintptr, maxStackSize)
91 - num := runtime.Callers(skip+2, pcs)
92 - stack := make(Stack, num)
93 - for i, pc := range pcs[:num] {
94 - fun := runtime.FuncForPC(pc)
95 - file, line := fun.FileLine(pc)
96 - stack[i].File = StripGOPATH(file)
97 - stack[i].Line = line
98 - stack[i].Name = StripPackage(fun.Name())
99 - }
100 - return stack
101 -}
102 -
103 -// CallersMulti returns a Multi which includes one Stack for the
104 -// current callers. The argument skip is the number of stack frames to ascend,
105 -// with 0 identifying the caller of CallersMulti.
106 -func CallersMulti(skip int) *Multi {
107 - m := new(Multi)
108 - m.AddCallers(skip + 1)
109 - return m
110 -}
111 -
112 -func writeStack(b *bytes.Buffer, s Stack) {
113 - var width int
114 - for _, f := range s {
115 - if l := len(f.File) + numDigits(f.Line) + 1; l > width {
116 - width = l
117 - }
118 - }
119 - last := len(s) - 1
120 - for i, f := range s {
121 - b.WriteString(f.File)
122 - b.WriteRune(rune(':'))
123 - n, _ := fmt.Fprintf(b, "%d", f.Line)
124 - for i := width - len(f.File) - n; i != 0; i-- {
125 - b.WriteRune(rune(' '))
126 - }
127 - b.WriteString(f.Name)
128 - if i != last {
129 - b.WriteRune(rune('\n'))
130 - }
131 - }
132 -}
133 -
134 -func numDigits(i int) int {
135 - var n int
136 - for {
137 - n++
138 - i = i / 10
139 - if i == 0 {
140 - return n
141 - }
142 - }
143 -}
144 -
145 -// This can be set by a build script. It will be the colon separated equivalent
146 -// of the environment variable.
147 -var gopath string
148 -
149 -// This is the processed version based on either the above variable set by the
150 -// build or from the GOPATH environment variable.
151 -var gopaths []string
152 -
153 -func init() {
154 - // prefer the variable set at build time, otherwise fallback to the
155 - // environment variable.
156 - if gopath == "" {
157 - gopath = os.Getenv("GOPATH")
158 - }
159 -
160 - for _, p := range strings.Split(gopath, ":") {
161 - if p != "" {
162 - gopaths = append(gopaths, filepath.Join(p, "src")+"/")
163 - }
164 - }
165 -
166 - // Also strip GOROOT for maximum cleanliness
167 - gopaths = append(gopaths, filepath.Join(runtime.GOROOT(), "src", "pkg")+"/")
168 -}
169 -
170 -// StripGOPATH strips the GOPATH prefix from the file path f.
171 -// In development, this will be done using the GOPATH environment variable.
172 -// For production builds, where the GOPATH environment will not be set, the
173 -// GOPATH can be included in the binary by passing ldflags, for example:
174 -//
175 -// GO_LDFLAGS="$GO_LDFLAGS -X github.com/facebookgo/stack.gopath $GOPATH"
176 -// go install "-ldflags=$GO_LDFLAGS" my/pkg
177 -func StripGOPATH(f string) string {
178 - for _, p := range gopaths {
179 - if strings.HasPrefix(f, p) {
180 - return f[len(p):]
181 - }
182 - }
183 - return f
184 -}
185 -
186 -// StripPackage strips the package name from the given Func.Name.
187 -func StripPackage(n string) string {
188 - slashI := strings.LastIndex(n, "/")
189 - if slashI == -1 {
190 - slashI = 0 // for built-in packages
191 - }
192 - dotI := strings.Index(n[slashI:], ".")
193 - if dotI == -1 {
194 - return n
195 - }
196 - return n[slashI+dotI+1:]
197 -}
Godeps/_workspace/src/github.com/facebookgo/stack/stack_test.go deleted
-102
@@ -1,102 +0,0 @@
1 -package stack_test
2 -
3 -import (
4 - "regexp"
5 - "strings"
6 - "testing"
7 -
8 - "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/facebookgo/stack"
9 -)
10 -
11 -func indirect1() stack.Stack {
12 - return stack.Callers(0)
13 -}
14 -
15 -func indirect2() stack.Stack {
16 - return indirect1()
17 -}
18 -
19 -func indirect3() stack.Stack {
20 - return indirect2()
21 -}
22 -
23 -func TestCallers(t *testing.T) {
24 - s := indirect3()
25 - matches := []string{
26 - "^github.com/facebookgo/stack/stack_test.go:12 +indirect1$",
27 - "^github.com/facebookgo/stack/stack_test.go:16 +indirect2$",
28 - "^github.com/facebookgo/stack/stack_test.go:20 +indirect3$",
29 - "^github.com/facebookgo/stack/stack_test.go:24 +TestCallers$",
30 - }
31 - match(t, s.String(), matches)
32 -}
33 -
34 -func TestCallersMulti(t *testing.T) {
35 - m := stack.CallersMulti(0)
36 - const expected = "github.com/facebookgo/stack/stack_test.go:35 TestCallersMulti"
37 - first := m.Stacks()[0][0].String()
38 - if first != expected {
39 - t.Fatalf(`expected "%s" got "%s"`, expected, first)
40 - }
41 -}
42 -
43 -func TestCallersMultiWithTwo(t *testing.T) {
44 - m := stack.CallersMulti(0)
45 - m.AddCallers(0)
46 - matches := []string{
47 - "^github.com/facebookgo/stack/stack_test.go:44 +TestCallersMultiWithTwo$",
48 - "",
49 - "",
50 - `^\(Stack 2\)$`,
51 - "^github.com/facebookgo/stack/stack_test.go:46 +TestCallersMultiWithTwo$",
52 - }
53 - match(t, m.String(), matches)
54 -}
55 -
56 -type typ struct{}
57 -
58 -func (m typ) indirect1() stack.Stack {
59 - return stack.Callers(0)
60 -}
61 -
62 -func (m typ) indirect2() stack.Stack {
63 - return m.indirect1()
64 -}
65 -
66 -func (m typ) indirect3() stack.Stack {
67 - return m.indirect2()
68 -}
69 -
70 -func TestCallersWithStruct(t *testing.T) {
71 - var m typ
72 - s := m.indirect3()
73 - matches := []string{
74 - "^github.com/facebookgo/stack/stack_test.go:59 +typ.indirect1$",
75 - "^github.com/facebookgo/stack/stack_test.go:63 +typ.indirect2$",
76 - "^github.com/facebookgo/stack/stack_test.go:67 +typ.indirect3$",
77 - "^github.com/facebookgo/stack/stack_test.go:72 +TestCallersWithStruct$",
78 - }
79 - match(t, s.String(), matches)
80 -}
81 -
82 -func TestCaller(t *testing.T) {
83 - f := stack.Caller(0)
84 - const expected = "github.com/facebookgo/stack/stack_test.go:83 TestCaller"
85 - if f.String() != expected {
86 - t.Fatalf(`expected "%s" got "%s"`, expected, f)
87 - }
88 -}
89 -
90 -func match(t testing.TB, s string, matches []string) {
91 - lines := strings.Split(s, "\n")
92 - for i, m := range matches {
93 - if !regexp.MustCompile(m).MatchString(lines[i]) {
94 - t.Fatalf(
95 - "did not find expected match \"%s\" on line %d in:\n%s",
96 - m,
97 - i,
98 - s,
99 - )
100 - }
101 - }
102 -}
Godeps/_workspace/src/github.com/facebookgo/stackerr/.travis.yml deleted
-24
@@ -1,24 +0,0 @@
1 -language: go
2 -
3 -go:
4 - - 1.2
5 - - 1.3
6 -
7 -matrix:
8 - fast_finish: true
9 -
10 -before_install:
11 - - go get -v code.google.com/p/go.tools/cmd/vet
12 - - go get -v github.com/golang/lint/golint
13 - - go get -v code.google.com/p/go.tools/cmd/cover
14 -
15 -install:
16 - - go install -race -v std
17 - - go get -race -t -v ./...
18 - - go install -race -v ./...
19 -
20 -script:
21 - - go vet ./...
22 - - $HOME/gopath/bin/golint .
23 - - go test -cpu=2 -race -v ./...
24 - - go test -cpu=2 -covermode=atomic ./...
Godeps/_workspace/src/github.com/facebookgo/stackerr/readme.md deleted
-4
@@ -1,4 +0,0 @@
1 -stackerr [![Build Status](https://secure.travis-ci.org/facebookgo/stackerr.png)](http://travis-ci.org/facebookgo/stackerr)
2 -========
3 -
4 -Documentation: https://godoc.org/github.com/facebookgo/stackerr
Godeps/_workspace/src/github.com/facebookgo/stackerr/stackerr.go deleted
-97
@@ -1,97 +0,0 @@
1 -// Package stackerr provides a way to augment errors with one or more stack
2 -// traces to allow for easier debugging.
3 -package stackerr
4 -
5 -import (
6 - "errors"
7 - "fmt"
8 -
9 - "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/facebookgo/stack"
10 -)
11 -
12 -// Error provides the wrapper that adds multiple Stacks to an error. Each Stack
13 -// represents a location in code thru which this error was wrapped.
14 -type Error struct {
15 - multiStack *stack.Multi
16 - underlying error
17 -}
18 -
19 -// Error provides a multi line error string that includes the stack trace.
20 -func (e *Error) Error() string {
21 - return fmt.Sprintf("%s\n%s", e.underlying, e.multiStack)
22 -}
23 -
24 -// MultiStack identifies the locations this error was wrapped at.
25 -func (e *Error) MultiStack() *stack.Multi {
26 - return e.multiStack
27 -}
28 -
29 -// Underlying returns the error that is being wrapped.
30 -func (e *Error) Underlying() error {
31 - return e.underlying
32 -}
33 -
34 -type hasMultiStack interface {
35 - MultiStack() *stack.Multi
36 -}
37 -
38 -// WrapSkip the error and add the current Stack. The argument skip is the
39 -// number of stack frames to ascend, with 0 identifying the caller of Wrap. If
40 -// the error to be wrapped has a MultiStack, the current stack will be added to
41 -// it. If the error to be wrapped is nil, a nil error is returned.
42 -func WrapSkip(err error, skip int) error {
43 - // nil errors are returned back as nil.
44 - if err == nil {
45 - return nil
46 - }
47 -
48 - // we're adding another Stack to an already wrapped error.
49 - if se, ok := err.(hasMultiStack); ok {
50 - se.MultiStack().AddCallers(skip + 1)
51 - return err
52 - }
53 -
54 - // we're create a freshly wrapped error.
55 - return &Error{
56 - multiStack: stack.CallersMulti(skip + 1),
57 - underlying: err,
58 - }
59 -}
60 -
61 -// Wrap provides a convenience function that calls WrapSkip with skip=0. That
62 -// is, the Stack starts with the caller of Wrap.
63 -func Wrap(err error) error {
64 - return WrapSkip(err, 1)
65 -}
66 -
67 -// New returns a new error that includes the Stack.
68 -func New(s string) error {
69 - return WrapSkip(errors.New(s), 1)
70 -}
71 -
72 -// Newf formats and returns a new error that includes the Stack.
73 -func Newf(format string, args ...interface{}) error {
74 - return WrapSkip(fmt.Errorf(format, args...), 1)
75 -}
76 -
77 -type hasUnderlying interface {
78 - Underlying() error
79 -}
80 -
81 -// Underlying returns all the underlying errors by iteratively checking if the
82 -// error has an Underlying error. If e is nil, the returned slice will be nil.
83 -func Underlying(e error) []error {
84 - var errs []error
85 - for {
86 - if e == nil {
87 - return errs
88 - }
89 - errs = append(errs, e)
90 -
91 - if eh, ok := e.(hasUnderlying); ok {
92 - e = eh.Underlying()
93 - } else {
94 - e = nil
95 - }
96 - }
97 -}
Godeps/_workspace/src/github.com/facebookgo/stackerr/stackerr_test.go deleted
-82
@@ -1,82 +0,0 @@
1 -package stackerr_test
2 -
3 -import (
4 - "errors"
5 - "fmt"
6 - "regexp"
7 - "strings"
8 - "testing"
9 -
10 - "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/facebookgo/stackerr"
11 -)
12 -
13 -func TestNew(t *testing.T) {
14 - const errStr = "foo bar baz"
15 - e := stackerr.New(errStr)
16 - matches := []string{
17 - errStr,
18 - "^github.com/facebookgo/stackerr/stackerr_test.go:15 +TestNew$",
19 - }
20 - match(t, e.Error(), matches)
21 -}
22 -
23 -func TestNewf(t *testing.T) {
24 - const fmtStr = "%s 42"
25 - const errStr = "foo bar baz"
26 - e := stackerr.Newf(fmtStr, errStr)
27 - matches := []string{
28 - fmt.Sprintf(fmtStr, errStr),
29 - "^github.com/facebookgo/stackerr/stackerr_test.go:26 +TestNewf$",
30 - }
31 - match(t, e.Error(), matches)
32 -}
33 -
34 -func TestWrap(t *testing.T) {
35 - const errStr = "foo bar baz"
36 - e := stackerr.Wrap(errors.New(errStr))
37 - matches := []string{
38 - errStr,
39 - "^github.com/facebookgo/stackerr/stackerr_test.go:36 +TestWrap$",
40 - }
41 - match(t, e.Error(), matches)
42 -}
43 -
44 -func TestNilWrap(t *testing.T) {
45 - if stackerr.WrapSkip(nil, 1) != nil {
46 - t.Fatal("did not get nil error")
47 - }
48 -}
49 -
50 -func TestDoubleWrap(t *testing.T) {
51 - e := stackerr.New("")
52 - if stackerr.WrapSkip(e, 1) != e {
53 - t.Fatal("double wrap failure")
54 - }
55 -}
56 -
57 -func TestLog(t *testing.T) {
58 - t.Log(stackerr.New("hello"))
59 -}
60 -
61 -func TestUnderlying(t *testing.T) {
62 - e1 := errors.New("")
63 - e2 := stackerr.Wrap(e1)
64 - errs := stackerr.Underlying(e2)
65 - if len(errs) != 2 || errs[0] != e2 || errs[1] != e1 {
66 - t.Fatal("failed Underlying")
67 - }
68 -}
69 -
70 -func match(t testing.TB, s string, matches []string) {
71 - lines := strings.Split(s, "\n")
72 - for i, m := range matches {
73 - if !regexp.MustCompile(m).MatchString(lines[i]) {
74 - t.Fatalf(
75 - "did not find expected match \"%s\" on line %d in:\n%s",
76 - m,
77 - i,
78 - s,
79 - )
80 - }
81 - }
82 -}
test/integration/addcat_test.go
+3 -2
@@ -2,6 +2,7 @@ package integrationtest
2
3 import (
4 "bytes"
5 + "errors"
6 "fmt"
7 "io"
8 "math"
@@ -11,12 +12,12 @@ import (
12
13 random "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-random"
14 context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
15 +
16 "github.com/ipfs/go-ipfs/core"
17 coreunix "github.com/ipfs/go-ipfs/core/coreunix"
18 mocknet "github.com/ipfs/go-ipfs/p2p/net/mock"
19 "github.com/ipfs/go-ipfs/p2p/peer"
20 "github.com/ipfs/go-ipfs/thirdparty/unit"
19 - errors "github.com/ipfs/go-ipfs/util/debugerror"
21 testutil "github.com/ipfs/go-ipfs/util/testutil"
22 )
23
@@ -91,7 +92,7 @@ func DirectAddCat(data []byte, conf testutil.LatencyConfig) error {
92 // create network
93 mn, err := mocknet.FullMeshLinked(ctx, numPeers)
94 if err != nil {
94 - return errors.Wrap(err)
95 + return err
96 }
97 mn.SetLinkDefaults(mocknet.LinkOptions{
98 Latency: conf.NetworkLatency,
test/integration/bench_cat_test.go
+2 -2
@@ -2,6 +2,7 @@ package integrationtest
2
3 import (
4 "bytes"
5 + "errors"
6 "io"
7 "math"
8 "testing"
@@ -12,7 +13,6 @@ import (
13 mocknet "github.com/ipfs/go-ipfs/p2p/net/mock"
14 "github.com/ipfs/go-ipfs/p2p/peer"
15 "github.com/ipfs/go-ipfs/thirdparty/unit"
15 - errors "github.com/ipfs/go-ipfs/util/debugerror"
16 testutil "github.com/ipfs/go-ipfs/util/testutil"
17 )
18
@@ -40,7 +40,7 @@ func benchCat(b *testing.B, data []byte, conf testutil.LatencyConfig) error {
40 // create network
41 mn, err := mocknet.FullMeshLinked(ctx, numPeers)
42 if err != nil {
43 - return errors.Wrap(err)
43 + return err
44 }
45 mn.SetLinkDefaults(mocknet.LinkOptions{
46 Latency: conf.NetworkLatency,
test/integration/bitswap_wo_routing_test.go
+2 -2
@@ -2,6 +2,7 @@ package integrationtest
2
3 import (
4 "bytes"
5 + "errors"
6 "testing"
7 "time"
8
@@ -9,7 +10,6 @@ import (
10 "github.com/ipfs/go-ipfs/blocks"
11 "github.com/ipfs/go-ipfs/core"
12 mocknet "github.com/ipfs/go-ipfs/p2p/net/mock"
12 - errors "github.com/ipfs/go-ipfs/util/debugerror"
13 testutil "github.com/ipfs/go-ipfs/util/testutil"
14 )
15
@@ -21,7 +21,7 @@ func TestBitswapWithoutRouting(t *testing.T) {
21 // create network
22 mn, err := mocknet.FullMeshLinked(ctx, numPeers)
23 if err != nil {
24 - t.Fatal(errors.Wrap(err))
24 + t.Fatal(err)
25 }
26
27 peers := mn.Peers()
test/integration/grandcentral_test.go
+3 -2
@@ -2,6 +2,7 @@ package integrationtest
2
3 import (
4 "bytes"
5 + "errors"
6 "fmt"
7 "io"
8 "math"
@@ -10,6 +11,7 @@ import (
11 "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
12 syncds "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/sync"
13 context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
14 +
15 core "github.com/ipfs/go-ipfs/core"
16 "github.com/ipfs/go-ipfs/core/corerouting"
17 "github.com/ipfs/go-ipfs/core/coreunix"
@@ -19,7 +21,6 @@ import (
21 "github.com/ipfs/go-ipfs/thirdparty/unit"
22 "github.com/ipfs/go-ipfs/util"
23 ds2 "github.com/ipfs/go-ipfs/util/datastore2"
22 - errors "github.com/ipfs/go-ipfs/util/debugerror"
24 testutil "github.com/ipfs/go-ipfs/util/testutil"
25 )
26
@@ -83,7 +84,7 @@ func InitializeSupernodeNetwork(
84 // create network
85 mn, err := mocknet.FullMeshLinked(ctx, numServers+numClients)
86 if err != nil {
86 - return nil, nil, errors.Wrap(err)
87 + return nil, nil, err
88 }
89
90 mn.SetLinkDefaults(mocknet.LinkOptions{
test/integration/three_legged_cat_test.go
+3 -2
@@ -2,18 +2,19 @@ package integrationtest
2
3 import (
4 "bytes"
5 + "errors"
6 "io"
7 "math"
8 "testing"
9 "time"
10
11 context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
12 +
13 core "github.com/ipfs/go-ipfs/core"
14 coreunix "github.com/ipfs/go-ipfs/core/coreunix"
15 mocknet "github.com/ipfs/go-ipfs/p2p/net/mock"
16 "github.com/ipfs/go-ipfs/p2p/peer"
17 "github.com/ipfs/go-ipfs/thirdparty/unit"
16 - errors "github.com/ipfs/go-ipfs/util/debugerror"
18 testutil "github.com/ipfs/go-ipfs/util/testutil"
19 )
20
@@ -68,7 +69,7 @@ func RunThreeLeggedCat(data []byte, conf testutil.LatencyConfig) error {
69 // create network
70 mn, err := mocknet.FullMeshLinked(ctx, numPeers)
71 if err != nil {
71 - return errors.Wrap(err)
72 + return err
73 }
74 mn.SetLinkDefaults(mocknet.LinkOptions{
75 Latency: conf.NetworkLatency,
util/debugerror/debug.go deleted
-30
@@ -1,30 +0,0 @@
1 -// package debugerror provides ways to augment errors with additional
2 -// information to allow for easier debugging.
3 -package debugerror
4 -
5 -import (
6 - "errors"
7 - "fmt"
8 -
9 - "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/facebookgo/stackerr"
10 - "github.com/ipfs/go-ipfs/util"
11 -)
12 -
13 -func Errorf(format string, a ...interface{}) error {
14 - return Wrap(fmt.Errorf(format, a...))
15 -}
16 -
17 -// New returns an error that contains a stack trace (in debug mode)
18 -func New(s string) error {
19 - if util.Debug {
20 - return stackerr.New(s)
21 - }
22 - return errors.New(s)
23 -}
24 -
25 -func Wrap(err error) error {
26 - if util.Debug {
27 - return stackerr.Wrap(err)
28 - }
29 - return err
30 -}