From 6457cc5ab8ec020f24c7b4cc883ebf4254a0124d Mon Sep 17 00:00:00 2001 From: Juan Batiz-Benet Date: Mon, 20 Apr 2015 00:15:34 -0700 Subject: [PATCH] go-ipfs-config: remove debugerrors We now consider debugerrors harmful: we've run into cases where debugerror.Wrap() hid valuable error information (err == io.EOF?). I've removed them from the main code, but left them in some tests. Go errors are lacking, but unfortunately, this isn't the solution. It is possible that debugerros.New or debugerrors.Errorf should remain still (i.e. only remove debugerrors.Wrap) but we don't use these errors often enough to keep. --- config/bootstrap_peers.go | 5 +++-- config/gateway.go | 2 +- config/init.go | 10 +++++----- config/log.go | 1 - 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/config/bootstrap_peers.go b/config/bootstrap_peers.go index af18ab17b..5fefae92f 100644 --- a/config/bootstrap_peers.go +++ b/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/config/gateway.go b/config/gateway.go index c0885778d..dfb72880c 100644 --- a/config/gateway.go +++ b/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/config/init.go b/config/init.go index 8f456f690..2b4bf2a08 100644 --- a/config/init.go +++ b/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/config/log.go b/config/log.go index abaa5c7cb..81aebf059 100644 --- a/config/log.go +++ b/config/log.go @@ -1,6 +1,5 @@ package config - type Log struct { MaxSizeMB int MaxBackups int