diff --git a/assets/contact.go b/assets/contact.go index 3714d538c..76db8d2b1 100644 --- a/assets/contact.go +++ b/assets/contact.go @@ -1,4 +1,5 @@ package assets + var Init_doc_contact = `Come hang out in our IRC chat room if you have any questions. Contact the ipfs dev team: diff --git a/assets/help.go b/assets/help.go index 9eeb7d237..8ca5fb255 100644 --- a/assets/help.go +++ b/assets/help.go @@ -1,4 +1,5 @@ package assets + var Init_doc_help = `Some helpful resources for finding your way around ipfs: - quick-start: a quick show of various ipfs features. diff --git a/assets/quick-start.go b/assets/quick-start.go index 3ffb36bbd..dfcac006b 100644 --- a/assets/quick-start.go +++ b/assets/quick-start.go @@ -1,4 +1,5 @@ package assets + var Init_doc_quick_start = `# 0.1 - Quick Start This is a set of short examples with minmal explanation. It is meant as diff --git a/assets/readme.go b/assets/readme.go index f49a107cc..fe7139317 100644 --- a/assets/readme.go +++ b/assets/readme.go @@ -1,4 +1,5 @@ package assets + var Init_doc_readme = `Hello and Welcome to IPFS! ██╗██████╗ ███████╗███████╗ diff --git a/assets/security-notes.go b/assets/security-notes.go index 9708d62eb..e3253a30e 100644 --- a/assets/security-notes.go +++ b/assets/security-notes.go @@ -1,4 +1,5 @@ package assets + var Init_doc_security_notes = ` IPFS Alpha Security Notes We try hard to ensure our system is safe and robust, but all software diff --git a/cmd/ipfs/daemon.go b/cmd/ipfs/daemon.go index cd2a1f466..75b4b0b48 100644 --- a/cmd/ipfs/daemon.go +++ b/cmd/ipfs/daemon.go @@ -14,7 +14,6 @@ import ( peer "github.com/ipfs/go-ipfs/p2p/peer" fsrepo "github.com/ipfs/go-ipfs/repo/fsrepo" util "github.com/ipfs/go-ipfs/util" - "github.com/ipfs/go-ipfs/util/debugerror" ) const ( @@ -56,7 +55,7 @@ in the network, use 0.0.0.0 as the ip address: ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8080 -Be careful if you expose the API. It is a security risk, as anyone could use control +Be careful if you expose the API. It is a security risk, as anyone could use control your node remotely. If you need to control the node remotely, make sure to protect the port as you would other services or database (firewall, authenticated proxy, etc).`, }, @@ -98,7 +97,7 @@ func daemonFunc(req cmds.Request, res cmds.Response) { if !util.FileExists(req.Context().ConfigRoot) { err := initWithDefaults(os.Stdout, req.Context().ConfigRoot) if err != nil { - res.SetError(debugerror.Wrap(err), cmds.ErrNormal) + res.SetError(err, cmds.ErrNormal) return } } @@ -120,7 +119,7 @@ func daemonFunc(req cmds.Request, res cmds.Response) { // sure we are permitted to access the resources (datastore, etc.) repo, err := fsrepo.Open(req.Context().ConfigRoot) if err != nil { - res.SetError(debugerror.Errorf("Couldn't obtain lock. Is another daemon already running?"), cmds.ErrNormal) + res.SetError(fmt.Errorf("Couldn't obtain lock. Is another daemon already running?"), cmds.ErrNormal) return } diff --git a/cmd/ipfs/init.go b/cmd/ipfs/init.go index a25a6d83c..66bdaf671 100644 --- a/cmd/ipfs/init.go +++ b/cmd/ipfs/init.go @@ -2,6 +2,7 @@ package main import ( "bytes" + "errors" "fmt" "io" @@ -15,7 +16,6 @@ import ( fsrepo "github.com/ipfs/go-ipfs/repo/fsrepo" uio "github.com/ipfs/go-ipfs/unixfs/io" u "github.com/ipfs/go-ipfs/util" - debugerror "github.com/ipfs/go-ipfs/util/debugerror" ) const nBitsForKeypairDefault = 4096 @@ -65,14 +65,14 @@ var initCmd = &cmds.Command{ }, } -var errRepoExists = debugerror.New(`ipfs configuration file already exists! +var errRepoExists = errors.New(`ipfs configuration file already exists! Reinitializing would overwrite your keys. (use -f to force overwrite) `) func initWithDefaults(out io.Writer, repoRoot string) error { err := doInit(out, repoRoot, false, nBitsForKeypairDefault) - return debugerror.Wrap(err) + return err } func doInit(out io.Writer, repoRoot string, force bool, nBitsForKeypair int) error { diff --git a/cmd/ipfs/main.go b/cmd/ipfs/main.go index 76d71a632..d501c77b4 100644 --- a/cmd/ipfs/main.go +++ b/cmd/ipfs/main.go @@ -26,7 +26,6 @@ import ( fsrepo "github.com/ipfs/go-ipfs/repo/fsrepo" eventlog "github.com/ipfs/go-ipfs/thirdparty/eventlog" u "github.com/ipfs/go-ipfs/util" - "github.com/ipfs/go-ipfs/util/debugerror" ) // log is the command logger @@ -355,7 +354,7 @@ func commandDetails(path []string, root *cmds.Command) (*cmdDetails, error) { var found bool cmd, found = cmd.Subcommands[cmp] if !found { - return nil, debugerror.Errorf("subcommand %s should be in root", cmp) + return nil, fmt.Errorf("subcommand %s should be in root", cmp) } if cmdDetails, found := cmdDetailsMap[cmd]; found { diff --git a/core/commands/add.go b/core/commands/add.go index e79a83264..9ee5f7d8d 100644 --- a/core/commands/add.go +++ b/core/commands/add.go @@ -18,7 +18,6 @@ import ( dag "github.com/ipfs/go-ipfs/merkledag" ft "github.com/ipfs/go-ipfs/unixfs" u "github.com/ipfs/go-ipfs/util" - "github.com/ipfs/go-ipfs/util/debugerror" ) // Error indicating the max depth has been exceded. @@ -106,19 +105,19 @@ remains to be implemented. rootnd, err := addFile(n, file, outChan, progress, wrap) if err != nil { - res.SetError(debugerror.Wrap(err), cmds.ErrNormal) + res.SetError(err, cmds.ErrNormal) return } err = n.Pinning.Pin(context.Background(), rootnd, true) if err != nil { - res.SetError(debugerror.Wrap(err), cmds.ErrNormal) + res.SetError(err, cmds.ErrNormal) return } err = n.Pinning.Flush() if err != nil { - res.SetError(debugerror.Wrap(err), cmds.ErrNormal) + res.SetError(err, cmds.ErrNormal) return } } diff --git a/core/commands/bootstrap.go b/core/commands/bootstrap.go index 187726d2c..e66467029 100644 --- a/core/commands/bootstrap.go +++ b/core/commands/bootstrap.go @@ -2,6 +2,7 @@ package commands import ( "bytes" + "errors" "io" "sort" @@ -10,7 +11,6 @@ import ( config "github.com/ipfs/go-ipfs/repo/config" "github.com/ipfs/go-ipfs/repo/fsrepo" u "github.com/ipfs/go-ipfs/util" - errors "github.com/ipfs/go-ipfs/util/debugerror" ) type BootstrapOutput struct { diff --git a/core/commands/swarm.go b/core/commands/swarm.go index f4524b8b7..2eaaadfde 100644 --- a/core/commands/swarm.go +++ b/core/commands/swarm.go @@ -2,13 +2,13 @@ package commands import ( "bytes" + "errors" "fmt" "io" "sort" cmds "github.com/ipfs/go-ipfs/commands" peer "github.com/ipfs/go-ipfs/p2p/peer" - errors "github.com/ipfs/go-ipfs/util/debugerror" iaddr "github.com/ipfs/go-ipfs/util/ipfsaddr" ma "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr" diff --git a/core/core.go b/core/core.go index aeaf6c8ce..0add89525 100644 --- a/core/core.go +++ b/core/core.go @@ -3,6 +3,7 @@ package core import ( + "errors" "fmt" "io" "time" @@ -14,7 +15,6 @@ import ( context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context" metrics "github.com/ipfs/go-ipfs/metrics" eventlog "github.com/ipfs/go-ipfs/thirdparty/eventlog" - debugerror "github.com/ipfs/go-ipfs/util/debugerror" diag "github.com/ipfs/go-ipfs/diagnostics" ic "github.com/ipfs/go-ipfs/p2p/crypto" @@ -133,7 +133,7 @@ func NewIPFSNode(parent context.Context, option ConfigOption) (*IpfsNode, error) node.Blocks, err = bserv.New(node.Blockstore, node.Exchange) if err != nil { - return nil, debugerror.Wrap(err) + return nil, err } if node.Peerstore == nil { node.Peerstore = peer.NewPeerstore() @@ -149,7 +149,7 @@ func NewIPFSNode(parent context.Context, option ConfigOption) (*IpfsNode, error) if node.OnlineMode() { fs, err := ipnsfs.NewFilesystem(ctx, node.DAG, node.Namesys, node.Pinning, node.PrivateKey) if err != nil && err != kb.ErrLookupFailure { - return nil, debugerror.Wrap(err) + return nil, err } node.IpnsFs = fs } @@ -192,7 +192,7 @@ func standardWithRouting(r repo.Repo, online bool, routingOption RoutingOption, // to test all node construction code paths. if r == nil { - return nil, debugerror.Errorf("repo required") + return nil, fmt.Errorf("repo required") } n = &IpfsNode{ mode: func() mode { @@ -214,7 +214,7 @@ func standardWithRouting(r repo.Repo, online bool, routingOption RoutingOption, n.Blockstore, err = bstore.WriteCached(bstore.NewBlockstore(n.Repo.Datastore()), kSizeBlockstoreWriteCache) if err != nil { - return nil, debugerror.Wrap(err) + return nil, err } if online { @@ -233,7 +233,7 @@ func standardWithRouting(r repo.Repo, online bool, routingOption RoutingOption, func (n *IpfsNode) startOnlineServices(ctx context.Context, routingOption RoutingOption, hostOption HostOption) error { if n.PeerHost != nil { // already online. - return debugerror.New("node already online") + return errors.New("node already online") } // load private key @@ -246,7 +246,7 @@ func (n *IpfsNode) startOnlineServices(ctx context.Context, routingOption Routin peerhost, err := hostOption(ctx, n.Identity, n.Peerstore, n.Reporter) if err != nil { - return debugerror.Wrap(err) + return err } if err := n.startOnlineServicesWithHost(ctx, peerhost, routingOption); err != nil { @@ -255,7 +255,7 @@ func (n *IpfsNode) startOnlineServices(ctx context.Context, routingOption Routin // Ok, now we're ready to listen. if err := startListening(ctx, n.PeerHost, n.Repo.Config()); err != nil { - return debugerror.Wrap(err) + return err } n.Reprovider = rp.NewReprovider(n.Routing, n.Blockstore) @@ -273,7 +273,7 @@ func (n *IpfsNode) startOnlineServicesWithHost(ctx context.Context, host p2phost // setup routing service r, err := routingOption(ctx, host, n.Repo.Datastore()) if err != nil { - return debugerror.Wrap(err) + return err } n.Routing = r @@ -380,15 +380,15 @@ func (n *IpfsNode) Bootstrap(cfg BootstrapConfig) error { func (n *IpfsNode) loadID() error { if n.Identity != "" { - return debugerror.New("identity already loaded") + return errors.New("identity already loaded") } cid := n.Repo.Config().Identity.PeerID if cid == "" { - return debugerror.New("Identity was not set in config (was ipfs init run?)") + return errors.New("Identity was not set in config (was ipfs init run?)") } if len(cid) == 0 { - return debugerror.New("No peer ID in config! (was ipfs init run?)") + return errors.New("No peer ID in config! (was ipfs init run?)") } n.Identity = peer.ID(b58.Decode(cid)) @@ -397,11 +397,11 @@ func (n *IpfsNode) loadID() error { func (n *IpfsNode) LoadPrivateKey() error { if n.Identity == "" || n.Peerstore == nil { - return debugerror.New("loaded private key out of order.") + return errors.New("loaded private key out of order.") } if n.PrivateKey != nil { - return debugerror.New("private key already loaded") + return errors.New("private key already loaded") } sk, err := loadPrivateKey(&n.Repo.Config().Identity, n.Identity) @@ -480,7 +480,7 @@ func constructPeerHost(ctx context.Context, id peer.ID, ps peer.Peerstore, bwr m // no addresses to begin with. we'll start later. network, err := swarm.NewNetwork(ctx, nil, id, ps, bwr) if err != nil { - return nil, debugerror.Wrap(err) + return nil, err } host := p2pbhost.New(network, p2pbhost.NATPortMap, bwr) @@ -492,7 +492,7 @@ func constructPeerHost(ctx context.Context, id peer.ID, ps peer.Peerstore, bwr m func startListening(ctx context.Context, host p2phost.Host, cfg *config.Config) error { listenAddrs, err := listenAddresses(cfg) if err != nil { - return debugerror.Wrap(err) + return err } // make sure we error out if our config does not have addresses we can use @@ -500,7 +500,7 @@ func startListening(ctx context.Context, host p2phost.Host, cfg *config.Config) filteredAddrs := addrutil.FilterUsableAddrs(listenAddrs) log.Debugf("Config.Addresses.Swarm:%s (filtered)", filteredAddrs) if len(filteredAddrs) < 1 { - return debugerror.Errorf("addresses in config not usable: %s", listenAddrs) + return fmt.Errorf("addresses in config not usable: %s", listenAddrs) } // Actually start listening: @@ -511,7 +511,7 @@ func startListening(ctx context.Context, host p2phost.Host, cfg *config.Config) // list out our addresses addrs, err := host.Network().InterfaceListenAddresses() if err != nil { - return debugerror.Wrap(err) + return err } log.Infof("Swarm listening at: %s", addrs) return nil diff --git a/exchange/bitswap/bitswap.go b/exchange/bitswap/bitswap.go index 78a421b57..ae0c76daa 100644 --- a/exchange/bitswap/bitswap.go +++ b/exchange/bitswap/bitswap.go @@ -3,6 +3,7 @@ package bitswap import ( + "errors" "math" "sync" "time" @@ -21,7 +22,6 @@ import ( "github.com/ipfs/go-ipfs/thirdparty/delay" eventlog "github.com/ipfs/go-ipfs/thirdparty/eventlog" u "github.com/ipfs/go-ipfs/util" - errors "github.com/ipfs/go-ipfs/util/debugerror" pset "github.com/ipfs/go-ipfs/util/peerset" // TODO move this to peerstore ) @@ -432,7 +432,7 @@ func (bs *Bitswap) ReceiveError(err error) { func (bs *Bitswap) send(ctx context.Context, p peer.ID, m bsmsg.BitSwapMessage) error { defer log.EventBegin(ctx, "sendMessage", p, m).Done() if err := bs.network.SendMessage(ctx, p, m); err != nil { - return errors.Wrap(err) + return err } return bs.engine.MessageSent(p, m) } diff --git a/exchange/reprovide/reprovide.go b/exchange/reprovide/reprovide.go index 42592c7e4..203a48e29 100644 --- a/exchange/reprovide/reprovide.go +++ b/exchange/reprovide/reprovide.go @@ -1,6 +1,7 @@ package reprovide import ( + "fmt" "time" backoff "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/cenkalti/backoff" @@ -8,7 +9,6 @@ import ( blocks "github.com/ipfs/go-ipfs/blocks/blockstore" routing "github.com/ipfs/go-ipfs/routing" eventlog "github.com/ipfs/go-ipfs/thirdparty/eventlog" - debugerror "github.com/ipfs/go-ipfs/util/debugerror" ) var log = eventlog.Logger("reprovider") @@ -50,7 +50,7 @@ func (rp *Reprovider) ProvideEvery(ctx context.Context, tick time.Duration) { func (rp *Reprovider) Reprovide(ctx context.Context) error { keychan, err := rp.bstore.AllKeysChan(ctx) if err != nil { - return debugerror.Errorf("Failed to get key chan from blockstore: %s", err) + return fmt.Errorf("Failed to get key chan from blockstore: %s", err) } for k := range keychan { op := func() error { diff --git a/p2p/net/conn/dial.go b/p2p/net/conn/dial.go index 0090678d6..43831c3ef 100644 --- a/p2p/net/conn/dial.go +++ b/p2p/net/conn/dial.go @@ -15,7 +15,6 @@ import ( addrutil "github.com/ipfs/go-ipfs/p2p/net/swarm/addr" peer "github.com/ipfs/go-ipfs/p2p/peer" - debugerror "github.com/ipfs/go-ipfs/util/debugerror" ) // String returns the string rep of d. @@ -107,7 +106,7 @@ func (d *Dialer) rawConnDial(ctx context.Context, raddr ma.Multiaddr, remote pee if strings.HasPrefix(raddr.String(), "/ip4/0.0.0.0") { log.Event(ctx, "connDialZeroAddr", lgbl.Dial("conn", d.LocalPeer, remote, nil, raddr)) - return nil, debugerror.Errorf("Attempted to connect to zero address: %s", raddr) + return nil, fmt.Errorf("Attempted to connect to zero address: %s", raddr) } // get local addr to use. diff --git a/p2p/net/conn/secure_conn.go b/p2p/net/conn/secure_conn.go index b79c3e054..7a8ce6f62 100644 --- a/p2p/net/conn/secure_conn.go +++ b/p2p/net/conn/secure_conn.go @@ -1,6 +1,7 @@ package conn import ( + "errors" "net" "time" @@ -11,7 +12,6 @@ import ( ic "github.com/ipfs/go-ipfs/p2p/crypto" secio "github.com/ipfs/go-ipfs/p2p/crypto/secio" peer "github.com/ipfs/go-ipfs/p2p/peer" - errors "github.com/ipfs/go-ipfs/util/debugerror" ) // secureConn wraps another Conn object with an encrypted channel. diff --git a/p2p/net/swarm/swarm_test.go b/p2p/net/swarm/swarm_test.go index e1416140e..9aa825320 100644 --- a/p2p/net/swarm/swarm_test.go +++ b/p2p/net/swarm/swarm_test.go @@ -2,6 +2,7 @@ package swarm import ( "bytes" + "fmt" "io" "sync" "testing" @@ -10,7 +11,6 @@ import ( metrics "github.com/ipfs/go-ipfs/metrics" inet "github.com/ipfs/go-ipfs/p2p/net" peer "github.com/ipfs/go-ipfs/p2p/peer" - errors "github.com/ipfs/go-ipfs/util/debugerror" testutil "github.com/ipfs/go-ipfs/util/testutil" ma "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr" @@ -130,7 +130,7 @@ func SubtestSwarm(t *testing.T, SwarmNum int, MsgNum int) { // first, one stream per peer (nice) stream, err := s1.NewStreamWithPeer(p) if err != nil { - errChan <- errors.Wrap(err) + errChan <- err return } @@ -177,12 +177,12 @@ func SubtestSwarm(t *testing.T, SwarmNum int, MsgNum int) { // read from the stream if _, err := stream.Read(msg); err != nil { - errChan <- errors.Wrap(err) + errChan <- err continue } if string(msg) != "pong" { - errChan <- errors.Errorf("unexpected message: %s", msg) + errChan <- fmt.Errorf("unexpected message: %s", msg) continue } @@ -195,7 +195,7 @@ func SubtestSwarm(t *testing.T, SwarmNum int, MsgNum int) { } if count != countShouldBe { - errChan <- errors.Errorf("count mismatch: %d != %d", count, countShouldBe) + errChan <- fmt.Errorf("count mismatch: %d != %d", count, countShouldBe) } }() diff --git a/repo/config/bootstrap_peers.go b/repo/config/bootstrap_peers.go index af18ab17b..5fefae92f 100644 --- a/repo/config/bootstrap_peers.go +++ b/repo/config/bootstrap_peers.go @@ -1,7 +1,8 @@ package config import ( - errors "github.com/ipfs/go-ipfs/util/debugerror" + "errors" + "fmt" iaddr "github.com/ipfs/go-ipfs/util/ipfsaddr" ) @@ -40,7 +41,7 @@ func (c *Config) BootstrapPeers() ([]BootstrapPeer, error) { func DefaultBootstrapPeers() ([]BootstrapPeer, error) { ps, err := ParseBootstrapPeers(DefaultBootstrapAddresses) if err != nil { - return nil, errors.Errorf(`failed to parse hardcoded bootstrap peers: %s + return nil, fmt.Errorf(`failed to parse hardcoded bootstrap peers: %s This is a problem with the ipfs codebase. Please report it to the dev team.`, err) } return ps, nil diff --git a/repo/config/gateway.go b/repo/config/gateway.go index c0885778d..dfb72880c 100644 --- a/repo/config/gateway.go +++ b/repo/config/gateway.go @@ -3,5 +3,5 @@ package config // Gateway contains options for the HTTP gateway server. type Gateway struct { RootRedirect string - Writable bool + Writable bool } diff --git a/repo/config/init.go b/repo/config/init.go index 8f456f690..2b4bf2a08 100644 --- a/repo/config/init.go +++ b/repo/config/init.go @@ -2,12 +2,12 @@ package config import ( "encoding/base64" + "errors" "fmt" "io" ci "github.com/ipfs/go-ipfs/p2p/crypto" peer "github.com/ipfs/go-ipfs/p2p/peer" - errors "github.com/ipfs/go-ipfs/util/debugerror" ) func Init(out io.Writer, nBitsForKeypair int) (*Config, error) { @@ -44,10 +44,10 @@ func Init(out io.Writer, nBitsForKeypair int) (*Config, error) { Gateway: "/ip4/127.0.0.1/tcp/8080", }, - Bootstrap: BootstrapPeerStrings(bootstrapPeers), - SupernodeRouting: *snr, - Datastore: *ds, - Identity: identity, + Bootstrap: BootstrapPeerStrings(bootstrapPeers), + SupernodeRouting: *snr, + Datastore: *ds, + Identity: identity, Log: Log{ MaxSizeMB: 250, MaxBackups: 1, diff --git a/repo/config/log.go b/repo/config/log.go index abaa5c7cb..81aebf059 100644 --- a/repo/config/log.go +++ b/repo/config/log.go @@ -1,6 +1,5 @@ package config - type Log struct { MaxSizeMB int MaxBackups int diff --git a/repo/fsrepo/fsrepo.go b/repo/fsrepo/fsrepo.go index 39aaf0ee6..84664ab5f 100644 --- a/repo/fsrepo/fsrepo.go +++ b/repo/fsrepo/fsrepo.go @@ -1,6 +1,8 @@ package fsrepo import ( + "errors" + "fmt" "io" "os" "path" @@ -20,7 +22,6 @@ import ( u "github.com/ipfs/go-ipfs/util" util "github.com/ipfs/go-ipfs/util" ds2 "github.com/ipfs/go-ipfs/util/datastore2" - debugerror "github.com/ipfs/go-ipfs/util/debugerror" ) const ( @@ -100,7 +101,7 @@ func open(repoPath string) (repo.Repo, error) { }() if !isInitializedUnsynced(r.path) { - return nil, debugerror.New("ipfs not initialized, please run 'ipfs init'") + return nil, errors.New("ipfs not initialized, please run 'ipfs init'") } // check repo path, then check all constituent parts. // TODO acquire repo lock @@ -191,7 +192,7 @@ func Init(repoPath string, conf *config.Config) error { // During Init, we merely check that the directory is writeable. p := path.Join(repoPath, defaultDataStoreDirectory) if err := dir.Writable(p); err != nil { - return debugerror.Errorf("datastore: %s", err) + return fmt.Errorf("datastore: %s", err) } if err := dir.Writable(path.Join(repoPath, "logs")); err != nil { @@ -240,7 +241,7 @@ func (r *FSRepo) openDatastore() error { Compression: ldbopts.NoCompression, }) if err != nil { - return debugerror.New("unable to open leveldb datastore") + return errors.New("unable to open leveldb datastore") } r.ds = ds return nil @@ -264,7 +265,7 @@ func (r *FSRepo) Close() error { defer packageLock.Unlock() if r.closed { - return debugerror.New("repo is closed") + return errors.New("repo is closed") } if err := r.ds.Close(); err != nil { @@ -349,7 +350,7 @@ func (r *FSRepo) GetConfigKey(key string) (interface{}, error) { defer packageLock.Unlock() if r.closed { - return nil, debugerror.New("repo is closed") + return nil, errors.New("repo is closed") } filename, err := config.Filename(r.path) @@ -369,7 +370,7 @@ func (r *FSRepo) SetConfigKey(key string, value interface{}) error { defer packageLock.Unlock() if r.closed { - return debugerror.New("repo is closed") + return errors.New("repo is closed") } filename, err := config.Filename(r.path) diff --git a/repo/fsrepo/lock/lock.go b/repo/fsrepo/lock/lock.go index 497c08a41..5681a5d38 100644 --- a/repo/fsrepo/lock/lock.go +++ b/repo/fsrepo/lock/lock.go @@ -6,7 +6,6 @@ import ( lock "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/camlistore/lock" "github.com/ipfs/go-ipfs/util" - "github.com/ipfs/go-ipfs/util/debugerror" ) // LockFile is the filename of the daemon lock, relative to config dir @@ -15,7 +14,7 @@ const LockFile = "daemon.lock" func Lock(confdir string) (io.Closer, error) { c, err := lock.Lock(path.Join(confdir, LockFile)) - return c, debugerror.Wrap(err) + return c, err } func Locked(confdir string) bool { diff --git a/repo/fsrepo/serialize/serialize.go b/repo/fsrepo/serialize/serialize.go index 30f62f9b1..2d87b8f6f 100644 --- a/repo/fsrepo/serialize/serialize.go +++ b/repo/fsrepo/serialize/serialize.go @@ -2,6 +2,7 @@ package fsrepo import ( "encoding/json" + "errors" "fmt" "io" "os" @@ -10,7 +11,6 @@ import ( "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/facebookgo/atomicfile" "github.com/ipfs/go-ipfs/repo/config" "github.com/ipfs/go-ipfs/util" - "github.com/ipfs/go-ipfs/util/debugerror" ) var log = util.Logger("fsrepo") @@ -59,7 +59,7 @@ func encode(w io.Writer, value interface{}) error { func Load(filename string) (*config.Config, error) { // if nothing is there, fail. User must run 'ipfs init' if !util.FileExists(filename) { - return nil, debugerror.New("ipfs not initialized, please run 'ipfs init'") + return nil, errors.New("ipfs not initialized, please run 'ipfs init'") } var cfg config.Config diff --git a/routing/dht/routing.go b/routing/dht/routing.go index 28967d200..47e892414 100644 --- a/routing/dht/routing.go +++ b/routing/dht/routing.go @@ -13,7 +13,6 @@ import ( kb "github.com/ipfs/go-ipfs/routing/kbucket" record "github.com/ipfs/go-ipfs/routing/record" u "github.com/ipfs/go-ipfs/util" - errors "github.com/ipfs/go-ipfs/util/debugerror" pset "github.com/ipfs/go-ipfs/util/peerset" ) @@ -95,7 +94,7 @@ func (dht *IpfsDHT) GetValue(ctx context.Context, key u.Key) ([]byte, error) { log.Debugf("peers in rt: %s", len(rtp), rtp) if len(rtp) == 0 { log.Warning("No peers from routing table!") - return nil, errors.Wrap(kb.ErrLookupFailure) + return nil, kb.ErrLookupFailure } // setup the Query @@ -278,7 +277,7 @@ func (dht *IpfsDHT) FindPeer(ctx context.Context, id peer.ID) (peer.PeerInfo, er peers := dht.routingTable.NearestPeers(kb.ConvertPeerID(id), AlphaValue) if len(peers) == 0 { - return peer.PeerInfo{}, errors.Wrap(kb.ErrLookupFailure) + return peer.PeerInfo{}, kb.ErrLookupFailure } // Sanity... @@ -344,7 +343,7 @@ func (dht *IpfsDHT) FindPeersConnectedToPeer(ctx context.Context, id peer.ID) (< peers := dht.routingTable.NearestPeers(kb.ConvertPeerID(id), AlphaValue) if len(peers) == 0 { - return nil, errors.Wrap(kb.ErrLookupFailure) + return nil, kb.ErrLookupFailure } // setup the Query diff --git a/routing/mock/dht.go b/routing/mock/dht.go index f4b2b4900..df8d7cdfc 100644 --- a/routing/mock/dht.go +++ b/routing/mock/dht.go @@ -30,7 +30,6 @@ func (rs *mocknetserver) ClientWithDatastore(ctx context.Context, p testutil.Ide host, err := rs.mn.AddPeer(p.PrivateKey(), p.Address()) if err != nil { panic("FIXME") - // return nil, debugerror.Wrap(err) } return dht.NewDHT(ctx, host, sync.MutexWrap(ds)) } diff --git a/routing/supernode/client.go b/routing/supernode/client.go index fa47e2e80..13f845abe 100644 --- a/routing/supernode/client.go +++ b/routing/supernode/client.go @@ -2,6 +2,7 @@ package supernode import ( "bytes" + "errors" "time" proto "github.com/ipfs/go-ipfs/Godeps/_workspace/src/code.google.com/p/goprotobuf/proto" @@ -13,7 +14,6 @@ import ( proxy "github.com/ipfs/go-ipfs/routing/supernode/proxy" eventlog "github.com/ipfs/go-ipfs/thirdparty/eventlog" u "github.com/ipfs/go-ipfs/util" - errors "github.com/ipfs/go-ipfs/util/debugerror" ) var log = eventlog.Logger("supernode") @@ -44,13 +44,13 @@ func (c *Client) FindProvidersAsync(ctx context.Context, k u.Key, max int) <-cha request := pb.NewMessage(pb.Message_GET_PROVIDERS, string(k), 0) response, err := c.proxy.SendRequest(ctx, request) if err != nil { - log.Debug(errors.Wrap(err)) + log.Debug(err) return } for _, p := range pb.PBPeersToPeerInfos(response.GetProviderPeers()) { select { case <-ctx.Done(): - log.Debug(errors.Wrap(ctx.Err())) + log.Debug(ctx.Err()) return case ch <- p: } @@ -75,7 +75,7 @@ func (c *Client) GetValue(ctx context.Context, k u.Key) ([]byte, error) { msg := pb.NewMessage(pb.Message_GET_VALUE, string(k), 0) response, err := c.proxy.SendRequest(ctx, msg) // TODO wrap to hide the remote if err != nil { - return nil, errors.Wrap(err) + return nil, err } return response.Record.GetValue(), nil } @@ -101,7 +101,7 @@ func (c *Client) FindPeer(ctx context.Context, id peer.ID) (peer.PeerInfo, error request := pb.NewMessage(pb.Message_FIND_NODE, string(id), 0) response, err := c.proxy.SendRequest(ctx, request) // hide remote if err != nil { - return peer.PeerInfo{}, errors.Wrap(err) + return peer.PeerInfo{}, err } for _, p := range pb.PBPeersToPeerInfos(response.GetCloserPeers()) { if p.ID == id { diff --git a/routing/supernode/proxy/loopback.go b/routing/supernode/proxy/loopback.go index 5d46fb4e1..06e91707c 100644 --- a/routing/supernode/proxy/loopback.go +++ b/routing/supernode/proxy/loopback.go @@ -6,7 +6,6 @@ import ( inet "github.com/ipfs/go-ipfs/p2p/net" peer "github.com/ipfs/go-ipfs/p2p/peer" dhtpb "github.com/ipfs/go-ipfs/routing/dht/pb" - errors "github.com/ipfs/go-ipfs/util/debugerror" ) // RequestHandler handles routing requests locally @@ -43,7 +42,7 @@ func (lb *Loopback) HandleStream(s inet.Stream) { pbr := ggio.NewDelimitedReader(s, inet.MessageSizeMax) var incoming dhtpb.Message if err := pbr.ReadMsg(&incoming); err != nil { - log.Debug(errors.Wrap(err)) + log.Debug(err) return } ctx := context.TODO() diff --git a/routing/supernode/proxy/standard.go b/routing/supernode/proxy/standard.go index 0a3d9e1b7..7f4d38faa 100644 --- a/routing/supernode/proxy/standard.go +++ b/routing/supernode/proxy/standard.go @@ -1,6 +1,8 @@ package proxy import ( + "errors" + ggio "github.com/ipfs/go-ipfs/Godeps/_workspace/src/code.google.com/p/gogoprotobuf/io" context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context" host "github.com/ipfs/go-ipfs/p2p/host" @@ -10,7 +12,6 @@ import ( kbucket "github.com/ipfs/go-ipfs/routing/kbucket" eventlog "github.com/ipfs/go-ipfs/thirdparty/eventlog" "github.com/ipfs/go-ipfs/util" - errors "github.com/ipfs/go-ipfs/util/debugerror" ) const ProtocolSNR = "/ipfs/supernoderouting" @@ -103,7 +104,7 @@ func (px *standard) sendMessage(ctx context.Context, m *dhtpb.Message, remote pe defer s.Close() pbw := ggio.NewDelimitedWriter(s) if err := pbw.WriteMsg(m); err != nil { - return errors.Wrap(err) + return err } return nil } diff --git a/routing/supernode/server.go b/routing/supernode/server.go index 44ef349d4..fb077e882 100644 --- a/routing/supernode/server.go +++ b/routing/supernode/server.go @@ -1,6 +1,7 @@ package supernode import ( + "errors" "fmt" proto "github.com/ipfs/go-ipfs/Godeps/_workspace/src/code.google.com/p/goprotobuf/proto" @@ -11,7 +12,6 @@ import ( record "github.com/ipfs/go-ipfs/routing/record" proxy "github.com/ipfs/go-ipfs/routing/supernode/proxy" util "github.com/ipfs/go-ipfs/util" - errors "github.com/ipfs/go-ipfs/util/debugerror" ) // Server handles routing queries using a database backend @@ -117,7 +117,7 @@ func getRoutingRecord(ds datastore.Datastore, k util.Key) (*dhtpb.Record, error) dskey := k.DsKey() val, err := ds.Get(dskey) if err != nil { - return nil, errors.Wrap(err) + return nil, err } recordBytes, ok := val.([]byte) if !ok {