From 7a6febbe38c6f70af77b45469affaf367f2909f0 Mon Sep 17 00:00:00 2001
From: Henry <cryptix@riseup.net>
Date: Tue, 28 Apr 2015 13:00:26 +0200
Subject: [PATCH] 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)
---
 Godeps/Godeps.json                            |   8 -
 .../github.com/facebookgo/stack/.travis.yml   |  24 ---
 .../src/github.com/facebookgo/stack/readme.md |   4 -
 .../src/github.com/facebookgo/stack/stack.go  | 197 ------------------
 .../github.com/facebookgo/stack/stack_test.go | 102 ---------
 .../facebookgo/stackerr/.travis.yml           |  24 ---
 .../github.com/facebookgo/stackerr/readme.md  |   4 -
 .../facebookgo/stackerr/stackerr.go           |  97 ---------
 .../facebookgo/stackerr/stackerr_test.go      |  82 --------
 test/integration/addcat_test.go               |   5 +-
 test/integration/bench_cat_test.go            |   4 +-
 test/integration/bitswap_wo_routing_test.go   |   4 +-
 test/integration/grandcentral_test.go         |   5 +-
 test/integration/three_legged_cat_test.go     |   5 +-
 util/debugerror/debug.go                      |  30 ---
 15 files changed, 13 insertions(+), 582 deletions(-)
 delete mode 100644 Godeps/_workspace/src/github.com/facebookgo/stack/.travis.yml
 delete mode 100644 Godeps/_workspace/src/github.com/facebookgo/stack/readme.md
 delete mode 100644 Godeps/_workspace/src/github.com/facebookgo/stack/stack.go
 delete mode 100644 Godeps/_workspace/src/github.com/facebookgo/stack/stack_test.go
 delete mode 100644 Godeps/_workspace/src/github.com/facebookgo/stackerr/.travis.yml
 delete mode 100644 Godeps/_workspace/src/github.com/facebookgo/stackerr/readme.md
 delete mode 100644 Godeps/_workspace/src/github.com/facebookgo/stackerr/stackerr.go
 delete mode 100644 Godeps/_workspace/src/github.com/facebookgo/stackerr/stackerr_test.go
 delete mode 100644 util/debugerror/debug.go

diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json
index d400606b1..a30d02d9c 100644
--- a/Godeps/Godeps.json
+++ b/Godeps/Godeps.json
@@ -77,14 +77,6 @@
 			"ImportPath": "github.com/facebookgo/atomicfile",
 			"Rev": "6f117f2e7f224fb03eb5e5fba370eade6e2b90c8"
 		},
-		{
-			"ImportPath": "github.com/facebookgo/stack",
-			"Rev": "4da6d991fc3c389efa512151354d643eb5fae4e2"
-		},
-		{
-			"ImportPath": "github.com/facebookgo/stackerr",
-			"Rev": "060fbf9364c89acd41bf710e9e92915a90e7a5b5"
-		},
 		{
 			"ImportPath": "github.com/fd/go-nat",
 			"Rev": "50e7633d5f27d81490026a13e5b92d2e42d8c6bb"
diff --git a/Godeps/_workspace/src/github.com/facebookgo/stack/.travis.yml b/Godeps/_workspace/src/github.com/facebookgo/stack/.travis.yml
deleted file mode 100644
index 2cc62c5e8..000000000
--- a/Godeps/_workspace/src/github.com/facebookgo/stack/.travis.yml
+++ /dev/null
@@ -1,24 +0,0 @@
-language: go
-
-go:
-  - 1.2
-  - 1.3
-
-matrix:
-  fast_finish: true
-
-before_install:
-  - go get -v code.google.com/p/go.tools/cmd/vet
-  - go get -v github.com/golang/lint/golint
-  - go get -v code.google.com/p/go.tools/cmd/cover
-
-install:
-  - go install -race -v std
-  - go get -race -t -v ./...
-  - go install -race -v ./...
-
-script:
-  - go vet ./...
-  - $HOME/gopath/bin/golint .
-  - go test -cpu=2 -race -v ./...
-  - go test -cpu=2 -covermode=atomic ./...
diff --git a/Godeps/_workspace/src/github.com/facebookgo/stack/readme.md b/Godeps/_workspace/src/github.com/facebookgo/stack/readme.md
deleted file mode 100644
index 680f7ad41..000000000
--- a/Godeps/_workspace/src/github.com/facebookgo/stack/readme.md
+++ /dev/null
@@ -1,4 +0,0 @@
-stack [![Build Status](https://secure.travis-ci.org/facebookgo/stack.png)](http://travis-ci.org/facebookgo/stack)
-=====
-
-Documentation: https://godoc.org/github.com/facebookgo/stack
diff --git a/Godeps/_workspace/src/github.com/facebookgo/stack/stack.go b/Godeps/_workspace/src/github.com/facebookgo/stack/stack.go
deleted file mode 100644
index c045daf57..000000000
--- a/Godeps/_workspace/src/github.com/facebookgo/stack/stack.go
+++ /dev/null
@@ -1,197 +0,0 @@
-// Package stack provides utilities to capture and pass around stack traces.
-//
-// This is useful for building errors that know where they originated from, to
-// track where a certain log event occured and so on.
-package stack
-
-import (
-	"bytes"
-	"fmt"
-	"os"
-	"path/filepath"
-	"runtime"
-	"strings"
-)
-
-const maxStackSize = 32
-
-// Frame identifies a file, line & function name in the stack.
-type Frame struct {
-	File string
-	Line int
-	Name string
-}
-
-// String provides the standard file:line representation.
-func (f Frame) String() string {
-	return fmt.Sprintf("%s:%d %s", f.File, f.Line, f.Name)
-}
-
-// Stack represents an ordered set of Frames.
-type Stack []Frame
-
-// String provides the standard multi-line stack trace.
-func (s Stack) String() string {
-	var b bytes.Buffer
-	writeStack(&b, s)
-	return b.String()
-}
-
-// Multi represents a number of Stacks. This is useful to allow tracking a
-// value as it travels thru code.
-type Multi struct {
-	stacks []Stack
-}
-
-// Stacks returns the tracked Stacks.
-func (m *Multi) Stacks() []Stack {
-	return m.stacks
-}
-
-// Add the given Stack to this Multi.
-func (m *Multi) Add(s Stack) {
-	m.stacks = append(m.stacks, s)
-}
-
-// AddCallers adds the Callers Stack to this Multi. The argument skip is
-// the number of stack frames to ascend, with 0 identifying the caller of
-// Callers.
-func (m *Multi) AddCallers(skip int) {
-	m.Add(Callers(skip + 1))
-}
-
-// String provides a human readable multi-line stack trace.
-func (m *Multi) String() string {
-	var b bytes.Buffer
-	for i, s := range m.stacks {
-		if i != 0 {
-			fmt.Fprintf(&b, "\n(Stack %d)\n", i+1)
-		}
-		writeStack(&b, s)
-	}
-	return b.String()
-}
-
-// Caller returns a single Frame for the caller. The argument skip is the
-// number of stack frames to ascend, with 0 identifying the caller of Callers.
-func Caller(skip int) Frame {
-	pc, file, line, _ := runtime.Caller(skip + 1)
-	fun := runtime.FuncForPC(pc)
-	return Frame{
-		File: StripGOPATH(file),
-		Line: line,
-		Name: StripPackage(fun.Name()),
-	}
-}
-
-// Callers returns a Stack of Frames for the callers. The argument skip is the
-// number of stack frames to ascend, with 0 identifying the caller of Callers.
-func Callers(skip int) Stack {
-	pcs := make([]uintptr, maxStackSize)
-	num := runtime.Callers(skip+2, pcs)
-	stack := make(Stack, num)
-	for i, pc := range pcs[:num] {
-		fun := runtime.FuncForPC(pc)
-		file, line := fun.FileLine(pc)
-		stack[i].File = StripGOPATH(file)
-		stack[i].Line = line
-		stack[i].Name = StripPackage(fun.Name())
-	}
-	return stack
-}
-
-// CallersMulti returns a Multi which includes one Stack for the
-// current callers. The argument skip is the number of stack frames to ascend,
-// with 0 identifying the caller of CallersMulti.
-func CallersMulti(skip int) *Multi {
-	m := new(Multi)
-	m.AddCallers(skip + 1)
-	return m
-}
-
-func writeStack(b *bytes.Buffer, s Stack) {
-	var width int
-	for _, f := range s {
-		if l := len(f.File) + numDigits(f.Line) + 1; l > width {
-			width = l
-		}
-	}
-	last := len(s) - 1
-	for i, f := range s {
-		b.WriteString(f.File)
-		b.WriteRune(rune(':'))
-		n, _ := fmt.Fprintf(b, "%d", f.Line)
-		for i := width - len(f.File) - n; i != 0; i-- {
-			b.WriteRune(rune(' '))
-		}
-		b.WriteString(f.Name)
-		if i != last {
-			b.WriteRune(rune('\n'))
-		}
-	}
-}
-
-func numDigits(i int) int {
-	var n int
-	for {
-		n++
-		i = i / 10
-		if i == 0 {
-			return n
-		}
-	}
-}
-
-// This can be set by a build script. It will be the colon separated equivalent
-// of the environment variable.
-var gopath string
-
-// This is the processed version based on either the above variable set by the
-// build or from the GOPATH environment variable.
-var gopaths []string
-
-func init() {
-	// prefer the variable set at build time, otherwise fallback to the
-	// environment variable.
-	if gopath == "" {
-		gopath = os.Getenv("GOPATH")
-	}
-
-	for _, p := range strings.Split(gopath, ":") {
-		if p != "" {
-			gopaths = append(gopaths, filepath.Join(p, "src")+"/")
-		}
-	}
-
-	// Also strip GOROOT for maximum cleanliness
-	gopaths = append(gopaths, filepath.Join(runtime.GOROOT(), "src", "pkg")+"/")
-}
-
-// StripGOPATH strips the GOPATH prefix from the file path f.
-// In development, this will be done using the GOPATH environment variable.
-// For production builds, where the GOPATH environment will not be set, the
-// GOPATH can be included in the binary by passing ldflags, for example:
-//
-//     GO_LDFLAGS="$GO_LDFLAGS -X github.com/facebookgo/stack.gopath $GOPATH"
-//     go install "-ldflags=$GO_LDFLAGS" my/pkg
-func StripGOPATH(f string) string {
-	for _, p := range gopaths {
-		if strings.HasPrefix(f, p) {
-			return f[len(p):]
-		}
-	}
-	return f
-}
-
-// StripPackage strips the package name from the given Func.Name.
-func StripPackage(n string) string {
-	slashI := strings.LastIndex(n, "/")
-	if slashI == -1 {
-		slashI = 0 // for built-in packages
-	}
-	dotI := strings.Index(n[slashI:], ".")
-	if dotI == -1 {
-		return n
-	}
-	return n[slashI+dotI+1:]
-}
diff --git a/Godeps/_workspace/src/github.com/facebookgo/stack/stack_test.go b/Godeps/_workspace/src/github.com/facebookgo/stack/stack_test.go
deleted file mode 100644
index 7c6769220..000000000
--- a/Godeps/_workspace/src/github.com/facebookgo/stack/stack_test.go
+++ /dev/null
@@ -1,102 +0,0 @@
-package stack_test
-
-import (
-	"regexp"
-	"strings"
-	"testing"
-
-	"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/facebookgo/stack"
-)
-
-func indirect1() stack.Stack {
-	return stack.Callers(0)
-}
-
-func indirect2() stack.Stack {
-	return indirect1()
-}
-
-func indirect3() stack.Stack {
-	return indirect2()
-}
-
-func TestCallers(t *testing.T) {
-	s := indirect3()
-	matches := []string{
-		"^github.com/facebookgo/stack/stack_test.go:12 +indirect1$",
-		"^github.com/facebookgo/stack/stack_test.go:16 +indirect2$",
-		"^github.com/facebookgo/stack/stack_test.go:20 +indirect3$",
-		"^github.com/facebookgo/stack/stack_test.go:24 +TestCallers$",
-	}
-	match(t, s.String(), matches)
-}
-
-func TestCallersMulti(t *testing.T) {
-	m := stack.CallersMulti(0)
-	const expected = "github.com/facebookgo/stack/stack_test.go:35 TestCallersMulti"
-	first := m.Stacks()[0][0].String()
-	if first != expected {
-		t.Fatalf(`expected "%s" got "%s"`, expected, first)
-	}
-}
-
-func TestCallersMultiWithTwo(t *testing.T) {
-	m := stack.CallersMulti(0)
-	m.AddCallers(0)
-	matches := []string{
-		"^github.com/facebookgo/stack/stack_test.go:44 +TestCallersMultiWithTwo$",
-		"",
-		"",
-		`^\(Stack 2\)$`,
-		"^github.com/facebookgo/stack/stack_test.go:46 +TestCallersMultiWithTwo$",
-	}
-	match(t, m.String(), matches)
-}
-
-type typ struct{}
-
-func (m typ) indirect1() stack.Stack {
-	return stack.Callers(0)
-}
-
-func (m typ) indirect2() stack.Stack {
-	return m.indirect1()
-}
-
-func (m typ) indirect3() stack.Stack {
-	return m.indirect2()
-}
-
-func TestCallersWithStruct(t *testing.T) {
-	var m typ
-	s := m.indirect3()
-	matches := []string{
-		"^github.com/facebookgo/stack/stack_test.go:59 +typ.indirect1$",
-		"^github.com/facebookgo/stack/stack_test.go:63 +typ.indirect2$",
-		"^github.com/facebookgo/stack/stack_test.go:67 +typ.indirect3$",
-		"^github.com/facebookgo/stack/stack_test.go:72 +TestCallersWithStruct$",
-	}
-	match(t, s.String(), matches)
-}
-
-func TestCaller(t *testing.T) {
-	f := stack.Caller(0)
-	const expected = "github.com/facebookgo/stack/stack_test.go:83 TestCaller"
-	if f.String() != expected {
-		t.Fatalf(`expected "%s" got "%s"`, expected, f)
-	}
-}
-
-func match(t testing.TB, s string, matches []string) {
-	lines := strings.Split(s, "\n")
-	for i, m := range matches {
-		if !regexp.MustCompile(m).MatchString(lines[i]) {
-			t.Fatalf(
-				"did not find expected match \"%s\" on line %d in:\n%s",
-				m,
-				i,
-				s,
-			)
-		}
-	}
-}
diff --git a/Godeps/_workspace/src/github.com/facebookgo/stackerr/.travis.yml b/Godeps/_workspace/src/github.com/facebookgo/stackerr/.travis.yml
deleted file mode 100644
index 2cc62c5e8..000000000
--- a/Godeps/_workspace/src/github.com/facebookgo/stackerr/.travis.yml
+++ /dev/null
@@ -1,24 +0,0 @@
-language: go
-
-go:
-  - 1.2
-  - 1.3
-
-matrix:
-  fast_finish: true
-
-before_install:
-  - go get -v code.google.com/p/go.tools/cmd/vet
-  - go get -v github.com/golang/lint/golint
-  - go get -v code.google.com/p/go.tools/cmd/cover
-
-install:
-  - go install -race -v std
-  - go get -race -t -v ./...
-  - go install -race -v ./...
-
-script:
-  - go vet ./...
-  - $HOME/gopath/bin/golint .
-  - go test -cpu=2 -race -v ./...
-  - go test -cpu=2 -covermode=atomic ./...
diff --git a/Godeps/_workspace/src/github.com/facebookgo/stackerr/readme.md b/Godeps/_workspace/src/github.com/facebookgo/stackerr/readme.md
deleted file mode 100644
index 8837ed070..000000000
--- a/Godeps/_workspace/src/github.com/facebookgo/stackerr/readme.md
+++ /dev/null
@@ -1,4 +0,0 @@
-stackerr [![Build Status](https://secure.travis-ci.org/facebookgo/stackerr.png)](http://travis-ci.org/facebookgo/stackerr)
-========
-
-Documentation: https://godoc.org/github.com/facebookgo/stackerr
diff --git a/Godeps/_workspace/src/github.com/facebookgo/stackerr/stackerr.go b/Godeps/_workspace/src/github.com/facebookgo/stackerr/stackerr.go
deleted file mode 100644
index a33a30719..000000000
--- a/Godeps/_workspace/src/github.com/facebookgo/stackerr/stackerr.go
+++ /dev/null
@@ -1,97 +0,0 @@
-// Package stackerr provides a way to augment errors with one or more stack
-// traces to allow for easier debugging.
-package stackerr
-
-import (
-	"errors"
-	"fmt"
-
-	"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/facebookgo/stack"
-)
-
-// Error provides the wrapper that adds multiple Stacks to an error. Each Stack
-// represents a location in code thru which this error was wrapped.
-type Error struct {
-	multiStack *stack.Multi
-	underlying error
-}
-
-// Error provides a multi line error string that includes the stack trace.
-func (e *Error) Error() string {
-	return fmt.Sprintf("%s\n%s", e.underlying, e.multiStack)
-}
-
-// MultiStack identifies the locations this error was wrapped at.
-func (e *Error) MultiStack() *stack.Multi {
-	return e.multiStack
-}
-
-// Underlying returns the error that is being wrapped.
-func (e *Error) Underlying() error {
-	return e.underlying
-}
-
-type hasMultiStack interface {
-	MultiStack() *stack.Multi
-}
-
-// WrapSkip the error and add the current Stack. The argument skip is the
-// number of stack frames to ascend, with 0 identifying the caller of Wrap. If
-// the error to be wrapped has a MultiStack, the current stack will be added to
-// it.  If the error to be wrapped is nil, a nil error is returned.
-func WrapSkip(err error, skip int) error {
-	// nil errors are returned back as nil.
-	if err == nil {
-		return nil
-	}
-
-	// we're adding another Stack to an already wrapped error.
-	if se, ok := err.(hasMultiStack); ok {
-		se.MultiStack().AddCallers(skip + 1)
-		return err
-	}
-
-	// we're create a freshly wrapped error.
-	return &Error{
-		multiStack: stack.CallersMulti(skip + 1),
-		underlying: err,
-	}
-}
-
-// Wrap provides a convenience function that calls WrapSkip with skip=0. That
-// is, the Stack starts with the caller of Wrap.
-func Wrap(err error) error {
-	return WrapSkip(err, 1)
-}
-
-// New returns a new error that includes the Stack.
-func New(s string) error {
-	return WrapSkip(errors.New(s), 1)
-}
-
-// Newf formats and returns a new error that includes the Stack.
-func Newf(format string, args ...interface{}) error {
-	return WrapSkip(fmt.Errorf(format, args...), 1)
-}
-
-type hasUnderlying interface {
-	Underlying() error
-}
-
-// Underlying returns all the underlying errors by iteratively checking if the
-// error has an Underlying error. If e is nil, the returned slice will be nil.
-func Underlying(e error) []error {
-	var errs []error
-	for {
-		if e == nil {
-			return errs
-		}
-		errs = append(errs, e)
-
-		if eh, ok := e.(hasUnderlying); ok {
-			e = eh.Underlying()
-		} else {
-			e = nil
-		}
-	}
-}
diff --git a/Godeps/_workspace/src/github.com/facebookgo/stackerr/stackerr_test.go b/Godeps/_workspace/src/github.com/facebookgo/stackerr/stackerr_test.go
deleted file mode 100644
index 859961846..000000000
--- a/Godeps/_workspace/src/github.com/facebookgo/stackerr/stackerr_test.go
+++ /dev/null
@@ -1,82 +0,0 @@
-package stackerr_test
-
-import (
-	"errors"
-	"fmt"
-	"regexp"
-	"strings"
-	"testing"
-
-	"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/facebookgo/stackerr"
-)
-
-func TestNew(t *testing.T) {
-	const errStr = "foo bar baz"
-	e := stackerr.New(errStr)
-	matches := []string{
-		errStr,
-		"^github.com/facebookgo/stackerr/stackerr_test.go:15 +TestNew$",
-	}
-	match(t, e.Error(), matches)
-}
-
-func TestNewf(t *testing.T) {
-	const fmtStr = "%s 42"
-	const errStr = "foo bar baz"
-	e := stackerr.Newf(fmtStr, errStr)
-	matches := []string{
-		fmt.Sprintf(fmtStr, errStr),
-		"^github.com/facebookgo/stackerr/stackerr_test.go:26 +TestNewf$",
-	}
-	match(t, e.Error(), matches)
-}
-
-func TestWrap(t *testing.T) {
-	const errStr = "foo bar baz"
-	e := stackerr.Wrap(errors.New(errStr))
-	matches := []string{
-		errStr,
-		"^github.com/facebookgo/stackerr/stackerr_test.go:36 +TestWrap$",
-	}
-	match(t, e.Error(), matches)
-}
-
-func TestNilWrap(t *testing.T) {
-	if stackerr.WrapSkip(nil, 1) != nil {
-		t.Fatal("did not get nil error")
-	}
-}
-
-func TestDoubleWrap(t *testing.T) {
-	e := stackerr.New("")
-	if stackerr.WrapSkip(e, 1) != e {
-		t.Fatal("double wrap failure")
-	}
-}
-
-func TestLog(t *testing.T) {
-	t.Log(stackerr.New("hello"))
-}
-
-func TestUnderlying(t *testing.T) {
-	e1 := errors.New("")
-	e2 := stackerr.Wrap(e1)
-	errs := stackerr.Underlying(e2)
-	if len(errs) != 2 || errs[0] != e2 || errs[1] != e1 {
-		t.Fatal("failed Underlying")
-	}
-}
-
-func match(t testing.TB, s string, matches []string) {
-	lines := strings.Split(s, "\n")
-	for i, m := range matches {
-		if !regexp.MustCompile(m).MatchString(lines[i]) {
-			t.Fatalf(
-				"did not find expected match \"%s\" on line %d in:\n%s",
-				m,
-				i,
-				s,
-			)
-		}
-	}
-}
diff --git a/test/integration/addcat_test.go b/test/integration/addcat_test.go
index dddf2b7c0..df38fbbdf 100644
--- a/test/integration/addcat_test.go
+++ b/test/integration/addcat_test.go
@@ -2,6 +2,7 @@ package integrationtest
 
 import (
 	"bytes"
+	"errors"
 	"fmt"
 	"io"
 	"math"
@@ -11,12 +12,12 @@ import (
 
 	random "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-random"
 	context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
+
 	"github.com/ipfs/go-ipfs/core"
 	coreunix "github.com/ipfs/go-ipfs/core/coreunix"
 	mocknet "github.com/ipfs/go-ipfs/p2p/net/mock"
 	"github.com/ipfs/go-ipfs/p2p/peer"
 	"github.com/ipfs/go-ipfs/thirdparty/unit"
-	errors "github.com/ipfs/go-ipfs/util/debugerror"
 	testutil "github.com/ipfs/go-ipfs/util/testutil"
 )
 
@@ -91,7 +92,7 @@ func DirectAddCat(data []byte, conf testutil.LatencyConfig) error {
 	// create network
 	mn, err := mocknet.FullMeshLinked(ctx, numPeers)
 	if err != nil {
-		return errors.Wrap(err)
+		return err
 	}
 	mn.SetLinkDefaults(mocknet.LinkOptions{
 		Latency: conf.NetworkLatency,
diff --git a/test/integration/bench_cat_test.go b/test/integration/bench_cat_test.go
index eff75cd73..23931b3db 100644
--- a/test/integration/bench_cat_test.go
+++ b/test/integration/bench_cat_test.go
@@ -2,6 +2,7 @@ package integrationtest
 
 import (
 	"bytes"
+	"errors"
 	"io"
 	"math"
 	"testing"
@@ -12,7 +13,6 @@ import (
 	mocknet "github.com/ipfs/go-ipfs/p2p/net/mock"
 	"github.com/ipfs/go-ipfs/p2p/peer"
 	"github.com/ipfs/go-ipfs/thirdparty/unit"
-	errors "github.com/ipfs/go-ipfs/util/debugerror"
 	testutil "github.com/ipfs/go-ipfs/util/testutil"
 )
 
@@ -40,7 +40,7 @@ func benchCat(b *testing.B, data []byte, conf testutil.LatencyConfig) error {
 	// create network
 	mn, err := mocknet.FullMeshLinked(ctx, numPeers)
 	if err != nil {
-		return errors.Wrap(err)
+		return err
 	}
 	mn.SetLinkDefaults(mocknet.LinkOptions{
 		Latency: conf.NetworkLatency,
diff --git a/test/integration/bitswap_wo_routing_test.go b/test/integration/bitswap_wo_routing_test.go
index eac771bc4..f0f5d5d31 100644
--- a/test/integration/bitswap_wo_routing_test.go
+++ b/test/integration/bitswap_wo_routing_test.go
@@ -2,6 +2,7 @@ package integrationtest
 
 import (
 	"bytes"
+	"errors"
 	"testing"
 	"time"
 
@@ -9,7 +10,6 @@ import (
 	"github.com/ipfs/go-ipfs/blocks"
 	"github.com/ipfs/go-ipfs/core"
 	mocknet "github.com/ipfs/go-ipfs/p2p/net/mock"
-	errors "github.com/ipfs/go-ipfs/util/debugerror"
 	testutil "github.com/ipfs/go-ipfs/util/testutil"
 )
 
@@ -21,7 +21,7 @@ func TestBitswapWithoutRouting(t *testing.T) {
 	// create network
 	mn, err := mocknet.FullMeshLinked(ctx, numPeers)
 	if err != nil {
-		t.Fatal(errors.Wrap(err))
+		t.Fatal(err)
 	}
 
 	peers := mn.Peers()
diff --git a/test/integration/grandcentral_test.go b/test/integration/grandcentral_test.go
index 074e8b88b..afc3a6688 100644
--- a/test/integration/grandcentral_test.go
+++ b/test/integration/grandcentral_test.go
@@ -2,6 +2,7 @@ package integrationtest
 
 import (
 	"bytes"
+	"errors"
 	"fmt"
 	"io"
 	"math"
@@ -10,6 +11,7 @@ import (
 	"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
 	syncds "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/sync"
 	context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
+
 	core "github.com/ipfs/go-ipfs/core"
 	"github.com/ipfs/go-ipfs/core/corerouting"
 	"github.com/ipfs/go-ipfs/core/coreunix"
@@ -19,7 +21,6 @@ import (
 	"github.com/ipfs/go-ipfs/thirdparty/unit"
 	"github.com/ipfs/go-ipfs/util"
 	ds2 "github.com/ipfs/go-ipfs/util/datastore2"
-	errors "github.com/ipfs/go-ipfs/util/debugerror"
 	testutil "github.com/ipfs/go-ipfs/util/testutil"
 )
 
@@ -83,7 +84,7 @@ func InitializeSupernodeNetwork(
 	// create network
 	mn, err := mocknet.FullMeshLinked(ctx, numServers+numClients)
 	if err != nil {
-		return nil, nil, errors.Wrap(err)
+		return nil, nil, err
 	}
 
 	mn.SetLinkDefaults(mocknet.LinkOptions{
diff --git a/test/integration/three_legged_cat_test.go b/test/integration/three_legged_cat_test.go
index 18ac7a3d4..0a5b9c62f 100644
--- a/test/integration/three_legged_cat_test.go
+++ b/test/integration/three_legged_cat_test.go
@@ -2,18 +2,19 @@ package integrationtest
 
 import (
 	"bytes"
+	"errors"
 	"io"
 	"math"
 	"testing"
 	"time"
 
 	context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
+
 	core "github.com/ipfs/go-ipfs/core"
 	coreunix "github.com/ipfs/go-ipfs/core/coreunix"
 	mocknet "github.com/ipfs/go-ipfs/p2p/net/mock"
 	"github.com/ipfs/go-ipfs/p2p/peer"
 	"github.com/ipfs/go-ipfs/thirdparty/unit"
-	errors "github.com/ipfs/go-ipfs/util/debugerror"
 	testutil "github.com/ipfs/go-ipfs/util/testutil"
 )
 
@@ -68,7 +69,7 @@ func RunThreeLeggedCat(data []byte, conf testutil.LatencyConfig) error {
 	// create network
 	mn, err := mocknet.FullMeshLinked(ctx, numPeers)
 	if err != nil {
-		return errors.Wrap(err)
+		return err
 	}
 	mn.SetLinkDefaults(mocknet.LinkOptions{
 		Latency: conf.NetworkLatency,
diff --git a/util/debugerror/debug.go b/util/debugerror/debug.go
deleted file mode 100644
index bbb0818a4..000000000
--- a/util/debugerror/debug.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// package debugerror provides ways to augment errors with additional
-// information to allow for easier debugging.
-package debugerror
-
-import (
-	"errors"
-	"fmt"
-
-	"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/facebookgo/stackerr"
-	"github.com/ipfs/go-ipfs/util"
-)
-
-func Errorf(format string, a ...interface{}) error {
-	return Wrap(fmt.Errorf(format, a...))
-}
-
-// New returns an error that contains a stack trace (in debug mode)
-func New(s string) error {
-	if util.Debug {
-		return stackerr.New(s)
-	}
-	return errors.New(s)
-}
-
-func Wrap(err error) error {
-	if util.Debug {
-		return stackerr.Wrap(err)
-	}
-	return err
-}
-- 
GitLab