diff --git a/cmd/ipfs/init.go b/cmd/ipfs/init.go index ee4171871a0..7ab0dff95ca 100644 --- a/cmd/ipfs/init.go +++ b/cmd/ipfs/init.go @@ -82,7 +82,7 @@ environment variable: Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) { cctx := env.(*oldcmds.Context) if cctx.Online { - res.SetError(errors.New("init must be run offline only!"), cmdkit.ErrNormal) + res.SetError(errors.New("init must be run offline only"), cmdkit.ErrNormal) return } diff --git a/cmd/seccat/seccat.go b/cmd/seccat/seccat.go index 9b465555110..574475922df 100644 --- a/cmd/seccat/seccat.go +++ b/cmd/seccat/seccat.go @@ -113,7 +113,7 @@ func main() { func setupPeer(a args) (peer.ID, pstore.Peerstore, error) { if a.keybits < 1024 { - return "", nil, errors.New("Bitsize less than 1024 is considered unsafe.") + return "", nil, errors.New("bitsize less than 1024 is considered unsafe") } out("generating key pair...") diff --git a/commands/legacy/request.go b/commands/legacy/request.go index 99b5fb9f2df..fd1668df8dd 100644 --- a/commands/legacy/request.go +++ b/commands/legacy/request.go @@ -173,20 +173,20 @@ func convertOptions(req *cmds.Request) error { if len(str) == 0 { value = "empty value" } - return fmt.Errorf("Could not convert %q to type %q (for option %q)", + return fmt.Errorf("could not convert %q to type %q (for option %q)", value, opt.Type().String(), "-"+k) } req.Options[k] = val } else { - return fmt.Errorf("Option %q should be type %q, but got type %q", + return fmt.Errorf("option %q should be type %q, but got type %q", k, opt.Type().String(), kind.String()) } } for _, name := range opt.Names() { if _, ok := req.Options[name]; name != k && ok { - return fmt.Errorf("Duplicate command options were provided (%q and %q)", + return fmt.Errorf("duplicate command options were provided (%q and %q)", k, name) } } diff --git a/core/commands/cat.go b/core/commands/cat.go index e3897d2bb45..6dc98cbf386 100644 --- a/core/commands/cat.go +++ b/core/commands/cat.go @@ -44,7 +44,7 @@ var CatCmd = &cmds.Command{ offset, _ := req.Options["offset"].(int) if offset < 0 { - res.SetError(fmt.Errorf("Cannot specify negative offset."), cmdkit.ErrNormal) + res.SetError(fmt.Errorf("cannot specify negative offset"), cmdkit.ErrNormal) return } @@ -54,7 +54,7 @@ var CatCmd = &cmds.Command{ return } if max < 0 { - res.SetError(fmt.Errorf("Cannot specify negative length."), cmdkit.ErrNormal) + res.SetError(fmt.Errorf("cannot specify negative length"), cmdkit.ErrNormal) return } if !found { diff --git a/core/commands/config.go b/core/commands/config.go index 2ac87b4892d..408fc0c9b7c 100644 --- a/core/commands/config.go +++ b/core/commands/config.go @@ -354,7 +354,7 @@ func transformConfig(configRoot string, configName string, transformer config.Tr func getConfig(r repo.Repo, key string) (*ConfigField, error) { value, err := r.GetConfigKey(key) if err != nil { - return nil, fmt.Errorf("Failed to get config value: %q", err) + return nil, fmt.Errorf("failed to get config value: %q", err) } return &ConfigField{ Key: key, @@ -392,7 +392,7 @@ func replaceConfig(r repo.Repo, file io.Reader) error { keyF, err := getConfig(r, config.PrivKeySelector) if err != nil { - return fmt.Errorf("Failed to get PrivKey") + return fmt.Errorf("failed to get PrivKey") } pkstr, ok := keyF.Value.(string) diff --git a/core/commands/dht.go b/core/commands/dht.go index 19fff257cf7..aceba7cea14 100644 --- a/core/commands/dht.go +++ b/core/commands/dht.go @@ -170,7 +170,7 @@ var findProvidersDhtCmd = &cmds.Command{ return } if numProviders < 1 { - res.SetError(fmt.Errorf("Number of providers must be greater than 0"), cmdkit.ErrNormal) + res.SetError(fmt.Errorf("number of providers must be greater than 0"), cmdkit.ErrNormal) return } diff --git a/core/commands/get.go b/core/commands/get.go index 7f70102ab2f..752c9924a3e 100644 --- a/core/commands/get.go +++ b/core/commands/get.go @@ -21,7 +21,7 @@ import ( "gx/ipfs/QmfAkMSt9Fwzk48QDJecPcwCUjnf2uG7MLnmCGTp4C6ouL/go-ipfs-cmds" ) -var ErrInvalidCompressionLevel = errors.New("Compression level must be between 1 and 9") +var ErrInvalidCompressionLevel = errors.New("compression level must be between 1 and 9") var GetCmd = &cmds.Command{ Helptext: cmdkit.HelpText{ diff --git a/core/commands/id.go b/core/commands/id.go index 70208586013..f81d32e514d 100644 --- a/core/commands/id.go +++ b/core/commands/id.go @@ -156,7 +156,7 @@ EXAMPLE: func printPeer(ps pstore.Peerstore, p peer.ID) (interface{}, error) { if p == "" { - return nil, errors.New("Attempted to print nil peer!") + return nil, errors.New("attempted to print nil peer") } info := new(IdOutput) diff --git a/core/commands/object/object.go b/core/commands/object/object.go index 94646c49ca9..fa7fda8fe46 100644 --- a/core/commands/object/object.go +++ b/core/commands/object/object.go @@ -665,7 +665,7 @@ func deserializeNode(nd *Node, dataFieldEncoding string) (*dag.ProtoNode, error) } dagnode.SetData(data) default: - return nil, fmt.Errorf("Unkown data field encoding") + return nil, fmt.Errorf("unkown data field encoding") } links := make([]*ipld.Link, len(nd.Links)) diff --git a/core/commands/pin.go b/core/commands/pin.go index f85a2e40028..eb669b7983b 100644 --- a/core/commands/pin.go +++ b/core/commands/pin.go @@ -297,7 +297,7 @@ Example: switch typeStr { case "all", "direct", "indirect", "recursive": default: - err = fmt.Errorf("Invalid type '%s', must be one of {direct, indirect, recursive, all}", typeStr) + err = fmt.Errorf("invalid type '%s', must be one of {direct, indirect, recursive, all}", typeStr) res.SetError(err, cmdkit.ErrClient) return } @@ -447,7 +447,7 @@ var verifyPinCmd = &cmds.Command{ quiet, _, _ := res.Request().Option("quiet").Bool() if verbose && quiet { - res.SetError(fmt.Errorf("The --verbose and --quiet options can not be used at the same time"), cmdkit.ErrNormal) + res.SetError(fmt.Errorf("the --verbose and --quiet options can not be used at the same time"), cmdkit.ErrNormal) } opts := pinVerifyOpts{ diff --git a/core/commands/publish.go b/core/commands/publish.go index fc1c6da6ef0..bf9d9719c1a 100644 --- a/core/commands/publish.go +++ b/core/commands/publish.go @@ -19,7 +19,7 @@ import ( "gx/ipfs/QmceUdzxkimdYsgtX733uNgzf1DLHyBKN6ehGSp85ayppM/go-ipfs-cmdkit" ) -var errNotOnline = errors.New("This command must be run in online mode. Try running 'ipfs daemon' first.") +var errNotOnline = errors.New("this command must be run in online mode. Try running 'ipfs daemon' first") var PublishCmd = &cmds.Command{ Helptext: cmdkit.HelpText{ diff --git a/core/commands/pubsub.go b/core/commands/pubsub.go index 09846caffa6..66167c98eb3 100644 --- a/core/commands/pubsub.go +++ b/core/commands/pubsub.go @@ -86,7 +86,7 @@ This command outputs data in the following encodings: } if n.Floodsub == nil { - res.SetError(fmt.Errorf("experimental pubsub feature not enabled. Run daemon with --enable-pubsub-experiment to use."), cmdkit.ErrNormal) + res.SetError(fmt.Errorf("experimental pubsub feature not enabled. Run daemon with --enable-pubsub-experiment to use"), cmdkit.ErrNormal) return } @@ -323,7 +323,7 @@ To use, the daemon must be run with '--enable-pubsub-experiment'. } if n.Floodsub == nil { - res.SetError(fmt.Errorf("experimental pubsub feature not enabled. Run daemon with --enable-pubsub-experiment to use."), cmdkit.ErrNormal) + res.SetError(fmt.Errorf("experimental pubsub feature not enabled. Run daemon with --enable-pubsub-experiment to use"), cmdkit.ErrNormal) return } diff --git a/core/core.go b/core/core.go index e8e2113ba1e..9c9ec6d1a70 100644 --- a/core/core.go +++ b/core/core.go @@ -696,7 +696,7 @@ func (n *IpfsNode) GetKey(name string) (ic.PrivKey, error) { func (n *IpfsNode) LoadPrivateKey() error { if n.Identity == "" || n.Peerstore == nil { - return errors.New("loaded private key out of order.") + return errors.New("loaded private key out of order") } if n.PrivateKey != nil { @@ -826,7 +826,7 @@ func listenAddresses(cfg *config.Config) ([]ma.Multiaddr, error) { for _, addr := range cfg.Addresses.Swarm { maddr, err := ma.NewMultiaddr(addr) if err != nil { - return nil, fmt.Errorf("Failure to parse config.Addresses.Swarm: %s", cfg.Addresses.Swarm) + return nil, fmt.Errorf("failure to parse config.Addresses.Swarm: %s", cfg.Addresses.Swarm) } listen = append(listen, maddr) } diff --git a/core/coreapi/object.go b/core/coreapi/object.go index 6cfd303b713..32c30edb2a6 100644 --- a/core/coreapi/object.go +++ b/core/coreapi/object.go @@ -300,7 +300,7 @@ func deserializeNode(nd *Node, dataFieldEncoding string) (*dag.ProtoNode, error) } dagnode.SetData(data) default: - return nil, fmt.Errorf("Unkown data field encoding") + return nil, fmt.Errorf("unkown data field encoding") } links := make([]*ipld.Link, len(nd.Links)) diff --git a/core/corerepo/gc.go b/core/corerepo/gc.go index af678eca2d7..af1db476e89 100644 --- a/core/corerepo/gc.go +++ b/core/corerepo/gc.go @@ -18,7 +18,7 @@ import ( var log = logging.Logger("corerepo") -var ErrMaxStorageExceeded = errors.New("Maximum storage limit exceeded. Maybe unpin some files?") +var ErrMaxStorageExceeded = errors.New("maximum storage limit exceeded. Try to unpin some files") type GC struct { Node *core.IpfsNode diff --git a/exchange/bitswap/testnet/virtual.go b/exchange/bitswap/testnet/virtual.go index 86b43c7c895..e887a5cf474 100644 --- a/exchange/bitswap/testnet/virtual.go +++ b/exchange/bitswap/testnet/virtual.go @@ -88,7 +88,7 @@ func (n *network) SendMessage( receiver, ok := n.clients[to] if !ok { - return errors.New("Cannot locate peer on network") + return errors.New("cannot locate peer on network") } // nb: terminate the context since the context wouldn't actually be passed @@ -107,7 +107,7 @@ func (n *network) SendMessage( func (n *network) deliver( r bsnet.Receiver, from peer.ID, message bsmsg.BitSwapMessage) error { if message == nil || from == "" { - return errors.New("Invalid input") + return errors.New("invalid input") } n.delay.Wait() diff --git a/exchange/reprovide/reprovide.go b/exchange/reprovide/reprovide.go index b01da5a3ab5..8049bfaf5e0 100644 --- a/exchange/reprovide/reprovide.go +++ b/exchange/reprovide/reprovide.go @@ -82,7 +82,7 @@ func (rp *Reprovider) Run(tick time.Duration) { func (rp *Reprovider) Reprovide() error { keychan, err := rp.keyProvider(rp.ctx) if err != nil { - return fmt.Errorf("Failed to get key chan: %s", err) + return fmt.Errorf("failed to get key chan: %s", err) } for c := range keychan { // hash security diff --git a/fuse/ipns/ipns_unix.go b/fuse/ipns/ipns_unix.go index 6b1836731da..e4d95c31a72 100644 --- a/fuse/ipns/ipns_unix.go +++ b/fuse/ipns/ipns_unix.go @@ -564,7 +564,7 @@ func (dir *Directory) Rename(ctx context.Context, req *fuse.RenameRequest, newDi return fuse.EPERM default: log.Error("Unknown node type for rename target dir!") - return errors.New("Unknown fs node type!") + return errors.New("unknown fs node type") } return nil } diff --git a/fuse/mount/fuse.go b/fuse/mount/fuse.go index 232afbd72f5..82d22afa534 100644 --- a/fuse/mount/fuse.go +++ b/fuse/mount/fuse.go @@ -81,7 +81,7 @@ func (m *mount) mount() error { // wait for the mount process to be done, or timed out. select { case <-time.After(MountTimeout): - return fmt.Errorf("Mounting %s timed out.", m.MountPoint()) + return fmt.Errorf("mounting %s timed out", m.MountPoint()) case err := <-errs: return err case <-m.fuseConn.Ready: diff --git a/fuse/mount/mount.go b/fuse/mount/mount.go index fb855cfaec2..db227b9e27e 100644 --- a/fuse/mount/mount.go +++ b/fuse/mount/mount.go @@ -82,7 +82,7 @@ func ForceUnmountManyTimes(m Mount, attempts int) error { <-time.After(time.Millisecond * 500) } - return fmt.Errorf("Unmount %s failed after 10 seconds of trying.", m.MountPoint()) + return fmt.Errorf("unmount %s failed after 10 seconds of trying", m.MountPoint()) } type closer struct { diff --git a/fuse/readonly/ipfs_test.go b/fuse/readonly/ipfs_test.go index 803fd0ca032..b4815e749f3 100644 --- a/fuse/readonly/ipfs_test.go +++ b/fuse/readonly/ipfs_test.go @@ -183,7 +183,7 @@ func TestIpfsStressRead(t *testing.T) { } if !bytes.Equal(rbuf, data) { - errs <- errors.New("Incorrect Read!") + errs <- errors.New("incorrect read") } } }() diff --git a/fuse/readonly/readonly_unix.go b/fuse/readonly/readonly_unix.go index 69d3dbf90f5..710fe8721ca 100644 --- a/fuse/readonly/readonly_unix.go +++ b/fuse/readonly/readonly_unix.go @@ -135,7 +135,7 @@ func (s *Node) Attr(ctx context.Context, a *fuse.Attr) error { a.Mode = 0777 | os.ModeSymlink a.Size = uint64(len(s.cached.GetData())) default: - return fmt.Errorf("Invalid data type - %s", s.cached.GetType()) + return fmt.Errorf("invalid data type - %s", s.cached.GetType()) } return nil } diff --git a/importer/balanced/balanced_test.go b/importer/balanced/balanced_test.go index aab46078e22..7f24b34874b 100644 --- a/importer/balanced/balanced_test.go +++ b/importer/balanced/balanced_test.go @@ -103,11 +103,11 @@ func TestTwoChunks(t *testing.T) { func arrComp(a, b []byte) error { if len(a) != len(b) { - return fmt.Errorf("Arrays differ in length. %d != %d", len(a), len(b)) + return fmt.Errorf("arrays differ in length. %d != %d", len(a), len(b)) } for i, v := range a { if v != b[i] { - return fmt.Errorf("Arrays differ at index: %d", i) + return fmt.Errorf("arrays differ at index: %d", i) } } return nil diff --git a/importer/trickle/trickle_test.go b/importer/trickle/trickle_test.go index ea7ceb18ded..c0fe536613a 100644 --- a/importer/trickle/trickle_test.go +++ b/importer/trickle/trickle_test.go @@ -141,11 +141,11 @@ func testBuilderConsistency(t *testing.T, rawLeaves UseRawLeaves) { func arrComp(a, b []byte) error { if len(a) != len(b) { - return fmt.Errorf("Arrays differ in length. %d != %d", len(a), len(b)) + return fmt.Errorf("arrays differ in length. %d != %d", len(a), len(b)) } for i, v := range a { if v != b[i] { - return fmt.Errorf("Arrays differ at index: %d", i) + return fmt.Errorf("arrays differ at index: %d", i) } } return nil diff --git a/importer/trickle/trickledag.go b/importer/trickle/trickledag.go index 1a576fc28fb..ddda0f354ef 100644 --- a/importer/trickle/trickledag.go +++ b/importer/trickle/trickledag.go @@ -283,7 +283,7 @@ func verifyTDagRec(n ipld.Node, depth int, p VerifyParams) error { } if pbn.GetType() != ft.TRaw { - return errors.New("Expected raw block") + return errors.New("expected raw block") } if p.RawLeaves { diff --git a/keystore/keystore_test.go b/keystore/keystore_test.go index 0731f252bb5..5058964f866 100644 --- a/keystore/keystore_test.go +++ b/keystore/keystore_test.go @@ -250,7 +250,7 @@ func assertDirContents(dir string, exp []string) error { } if len(finfos) != len(exp) { - return fmt.Errorf("Expected %d directory entries", len(exp)) + return fmt.Errorf("expected %d directory entries", len(exp)) } var names []string diff --git a/merkledag/coding.go b/merkledag/coding.go index 62b8353b294..f76631b2e04 100644 --- a/merkledag/coding.go +++ b/merkledag/coding.go @@ -21,7 +21,7 @@ import ( func (n *ProtoNode) unmarshal(encoded []byte) error { var pbn pb.PBNode if err := pbn.Unmarshal(encoded); err != nil { - return fmt.Errorf("Unmarshal failed. %v", err) + return fmt.Errorf("unmarshal failed. %v", err) } pbnl := pbn.GetLinks() @@ -30,7 +30,7 @@ func (n *ProtoNode) unmarshal(encoded []byte) error { n.links[i] = &ipld.Link{Name: l.GetName(), Size: l.GetTsize()} c, err := cid.Cast(l.GetHash()) if err != nil { - return fmt.Errorf("Link hash #%d is not valid multihash. %v", i, err) + return fmt.Errorf("link hash #%d is not valid multihash. %v", i, err) } n.links[i].Cid = c } @@ -47,7 +47,7 @@ func (n *ProtoNode) Marshal() ([]byte, error) { pbn := n.getPBNode() data, err := pbn.Marshal() if err != nil { - return data, fmt.Errorf("Marshal failed. %v", err) + return data, fmt.Errorf("marshal failed. %v", err) } return data, nil } @@ -123,9 +123,9 @@ func DecodeProtobufBlock(b blocks.Block) (ipld.Node, error) { decnd, err := DecodeProtobuf(b.RawData()) if err != nil { if strings.Contains(err.Error(), "Unmarshal failed") { - return nil, fmt.Errorf("The block referred to by '%s' was not a valid merkledag node", c) + return nil, fmt.Errorf("the block referred to by '%s' was not a valid merkledag node", c) } - return nil, fmt.Errorf("Failed to decode Protocol Buffers: %v", err) + return nil, fmt.Errorf("failed to decode Protocol Buffers: %v", err) } decnd.cached = c diff --git a/merkledag/merkledag.go b/merkledag/merkledag.go index c7a6296daee..915997274b9 100644 --- a/merkledag/merkledag.go +++ b/merkledag/merkledag.go @@ -74,7 +74,7 @@ func (n *dagService) Get(ctx context.Context, c *cid.Cid) (ipld.Node, error) { if err == bserv.ErrNotFound { return nil, ipld.ErrNotFound } - return nil, fmt.Errorf("Failed to get block for %s: %v", c, err) + return nil, fmt.Errorf("failed to get block for %s: %v", c, err) } return ipld.Decode(b) diff --git a/merkledag/merkledag_test.go b/merkledag/merkledag_test.go index d67a20aa7b9..1591e94f1cf 100644 --- a/merkledag/merkledag_test.go +++ b/merkledag/merkledag_test.go @@ -239,7 +239,7 @@ func runBatchFetchTest(t *testing.T, read io.Reader) { } if !bytes.Equal(datagot, expected) { - errs <- errors.New("Got bad data back!") + errs <- errors.New("got bad data back") } }(i) } diff --git a/mfs/mfs_test.go b/mfs/mfs_test.go index ce820829376..6255c90c478 100644 --- a/mfs/mfs_test.go +++ b/mfs/mfs_test.go @@ -108,7 +108,7 @@ func assertDirAtPath(root *Directory, pth string, children []string) error { sort.Strings(children) sort.Strings(names) if !compStrArrs(children, names) { - return errors.New("directories children did not match!") + return errors.New("directories children did not match") } return nil @@ -158,7 +158,7 @@ func assertFileAtPath(ds ipld.DAGService, root *Directory, expn ipld.Node, pth s file, ok := finaln.(*File) if !ok { - return fmt.Errorf("%s was not a file!", pth) + return fmt.Errorf("%s was not a file", pth) } rfd, err := file.Open(OpenReadOnly, false) @@ -177,7 +177,7 @@ func assertFileAtPath(ds ipld.DAGService, root *Directory, expn ipld.Node, pth s } if !bytes.Equal(out, expbytes) { - return fmt.Errorf("Incorrect data at path!") + return fmt.Errorf("incorrect data at path") } return nil } @@ -616,7 +616,7 @@ func randomFile(d *Directory) (*File, error) { fi, ok := fsn.(*File) if !ok { - return nil, errors.New("file wasnt a file, race?") + return nil, errors.New("file wasn't a file, race?") } return fi, nil @@ -889,7 +889,7 @@ func readFile(rt *Root, path string, offset int64, buf []byte) error { return err } if nread != len(buf) { - return fmt.Errorf("didnt read enough!") + return fmt.Errorf("didn't read enough") } return fd.Close() diff --git a/namesys/dns_test.go b/namesys/dns_test.go index 1a3110c9bcf..2a58124ed47 100644 --- a/namesys/dns_test.go +++ b/namesys/dns_test.go @@ -14,7 +14,7 @@ type mockDNS struct { func (m *mockDNS) lookupTXT(name string) (txt []string, err error) { txt, ok := m.entries[name] if !ok { - return nil, fmt.Errorf("No TXT entry for %s", name) + return nil, fmt.Errorf("no TXT entry for %s", name) } return txt, nil } diff --git a/namesys/interface.go b/namesys/interface.go index db2aa0a22e1..4def9b1d713 100644 --- a/namesys/interface.go +++ b/namesys/interface.go @@ -37,18 +37,19 @@ import ( opts "github.com/ipfs/go-ipfs/namesys/opts" path "github.com/ipfs/go-ipfs/path" + ci "gx/ipfs/QmaPbCnUMBohSGo3KnxEa2bHqyJVVeEEcwtqJAYxerieBo/go-libp2p-crypto" ) // ErrResolveFailed signals an error when attempting to resolve. -var ErrResolveFailed = errors.New("Could not resolve name.") +var ErrResolveFailed = errors.New("could not resolve name") // ErrResolveRecursion signals a recursion-depth limit. var ErrResolveRecursion = errors.New( - "Could not resolve name (recursion limit exceeded).") + "could not resolve name (recursion limit exceeded)") // ErrPublishFailed signals an error when attempting to publish. -var ErrPublishFailed = errors.New("Could not publish name.") +var ErrPublishFailed = errors.New("could not publish name") // Namesys represents a cohesive name publishing and resolving system. // diff --git a/namesys/namesys_test.go b/namesys/namesys_test.go index e0d9ecf0827..9b27cf32204 100644 --- a/namesys/namesys_test.go +++ b/namesys/namesys_test.go @@ -24,7 +24,7 @@ func testResolution(t *testing.T, resolver Resolver, name string, depth uint, ex p, err := resolver.Resolve(context.Background(), name, opts.Depth(depth)) if err != expError { t.Fatal(fmt.Errorf( - "Expected %s with a depth of %d to have a '%s' error, but got '%s'", + "expected %s with a depth of %d to have a '%s' error, but got '%s'", name, depth, expError, err)) } if p.String() != expected { diff --git a/namesys/pubsub.go b/namesys/pubsub.go index 8f87227211e..4173fb6e85f 100644 --- a/namesys/pubsub.go +++ b/namesys/pubsub.go @@ -203,7 +203,7 @@ func (r *PubsubResolver) resolveOnce(ctx context.Context, name string, options * id := peer.ID(hash) if r.host.Peerstore().PrivKey(id) != nil { - return "", errors.New("Cannot resolve own name through pubsub") + return "", errors.New("cannot resolve own name through pubsub") } pubk := id.ExtractPublicKey() diff --git a/namesys/resolve_test.go b/namesys/resolve_test.go index 31bfd495682..9999801e402 100644 --- a/namesys/resolve_test.go +++ b/namesys/resolve_test.go @@ -131,7 +131,7 @@ func verifyCanResolve(r Resolver, name string, exp path.Path) error { } if res != exp { - return errors.New("got back wrong record!") + return errors.New("got back wrong record") } return nil diff --git a/pin/pin.go b/pin/pin.go index 08eed36fe10..8b6eb0aefeb 100644 --- a/pin/pin.go +++ b/pin/pin.go @@ -305,7 +305,7 @@ func (p *pinner) isPinnedWithType(c *cid.Cid, mode Mode) (string, bool, error) { switch mode { case Any, Direct, Indirect, Recursive, Internal: default: - err := fmt.Errorf("Invalid Pin Mode '%d', must be one of {%d, %d, %d, %d, %d}", + err := fmt.Errorf("invalid Pin Mode '%d', must be one of {%d, %d, %d, %d, %d}", mode, Direct, Indirect, Recursive, Internal, Any) return "", false, err } diff --git a/repo/config/config.go b/repo/config/config.go index 719170baad8..8ec6d324aeb 100644 --- a/repo/config/config.go +++ b/repo/config/config.go @@ -93,7 +93,7 @@ func FromMap(v map[string]interface{}) (*Config, error) { } var conf Config if err := json.NewDecoder(buf).Decode(&conf); err != nil { - return nil, fmt.Errorf("Failure to decode config: %s", err) + return nil, fmt.Errorf("failure to decode config: %s", err) } return &conf, nil } @@ -105,7 +105,7 @@ func ToMap(conf *Config) (map[string]interface{}, error) { } var m map[string]interface{} if err := json.NewDecoder(buf).Decode(&m); err != nil { - return nil, fmt.Errorf("Failure to decode config: %s", err) + return nil, fmt.Errorf("failure to decode config: %s", err) } return m, nil } diff --git a/repo/config/init.go b/repo/config/init.go index 54d17f7b7bf..6efc8712515 100644 --- a/repo/config/init.go +++ b/repo/config/init.go @@ -153,7 +153,7 @@ func identityConfig(out io.Writer, nbits int) (Identity, error) { // TODO guard higher up ident := Identity{} if nbits < 1024 { - return ident, errors.New("Bitsize less than 1024 is considered unsafe.") + return ident, errors.New("bitsize less than 1024 is considered unsafe") } fmt.Fprintf(out, "generating %v-bit RSA keypair...", nbits) diff --git a/repo/fsrepo/fsrepo.go b/repo/fsrepo/fsrepo.go index 197e7b61b39..44c0af35b0c 100644 --- a/repo/fsrepo/fsrepo.go +++ b/repo/fsrepo/fsrepo.go @@ -50,7 +50,7 @@ See https://github.com/ipfs/fs-repo-migrations/blob/master/run.md for details.` var ( ErrNoVersion = errors.New("no version file found, please run 0-to-1 migration tool.\n" + migrationInstructions) ErrOldRepo = errors.New("ipfs repo found in old '~/.go-ipfs' location, please run migration tool.\n" + migrationInstructions) - ErrNeedMigration = errors.New("ipfs repo needs migration.") + ErrNeedMigration = errors.New("ipfs repo needs migration") ) type NoRepoError struct { @@ -412,7 +412,7 @@ func (r *FSRepo) openDatastore() error { return err } if oldSpec != spec.String() { - return fmt.Errorf("Datastore configuration of '%s' does not match what is on disk '%s'", + return fmt.Errorf("datastore configuration of '%s' does not match what is on disk '%s'", oldSpec, spec.String()) } @@ -633,7 +633,7 @@ func (r *FSRepo) SetConfigKey(key string, value interface{}) error { default: } if !ok { - return fmt.Errorf("Wrong config type, expected %T", oldValue) + return fmt.Errorf("wrong config type, expected %T", oldValue) } } diff --git a/repo/fsrepo/serialize/serialize.go b/repo/fsrepo/serialize/serialize.go index d98a5264011..9762d40006d 100644 --- a/repo/fsrepo/serialize/serialize.go +++ b/repo/fsrepo/serialize/serialize.go @@ -9,6 +9,7 @@ import ( "path/filepath" "github.com/ipfs/go-ipfs/repo/config" + "gx/ipfs/QmNiJuT8Ja3hMVpBHXv3Q6dwmperaQ6JjLtpMQgMCD7xvx/go-ipfs-util" "gx/ipfs/QmdYwCmx8pZRkzdcd8MhmLJqYVoVTC1aGsy5Q4reMGLNLg/atomicfile" ) @@ -21,7 +22,7 @@ func ReadConfigFile(filename string, cfg interface{}) error { } defer f.Close() if err := json.NewDecoder(f).Decode(cfg); err != nil { - return fmt.Errorf("Failure to decode config: %s", err) + return fmt.Errorf("failure to decode config: %s", err) } return nil } diff --git a/thirdparty/pollEndpoint/main.go b/thirdparty/pollEndpoint/main.go index 89531f1ee44..4d478015a37 100644 --- a/thirdparty/pollEndpoint/main.go +++ b/thirdparty/pollEndpoint/main.go @@ -82,7 +82,7 @@ func checkOK(resp *http.Response, err error) error { if err != nil { fmt.Fprintf(os.Stderr, "pollEndpoint: ioutil.ReadAll() Error: %s", err) } - return fmt.Errorf("Response not OK. %d %s %q", resp.StatusCode, resp.Status, string(body)) + return fmt.Errorf("response not OK. %d %s %q", resp.StatusCode, resp.Status, string(body)) } return err } diff --git a/unixfs/io/pbdagreader.go b/unixfs/io/pbdagreader.go index ac08fade815..a194dccf430 100644 --- a/unixfs/io/pbdagreader.go +++ b/unixfs/io/pbdagreader.go @@ -238,7 +238,7 @@ func (dr *PBDagReader) Seek(offset int64, whence int) (int64, error) { switch whence { case io.SeekStart: if offset < 0 { - return -1, errors.New("Invalid offset") + return -1, errors.New("invalid offset") } if offset == dr.offset { return offset, nil diff --git a/unixfs/test/utils.go b/unixfs/test/utils.go index f96fcfcb527..574b7ec9724 100644 --- a/unixfs/test/utils.go +++ b/unixfs/test/utils.go @@ -95,11 +95,11 @@ func GetRandomNode(t testing.TB, dserv ipld.DAGService, size int64, opts NodeOpt // ArrComp checks if two byte slices are the same. func ArrComp(a, b []byte) error { if len(a) != len(b) { - return fmt.Errorf("Arrays differ in length. %d != %d", len(a), len(b)) + return fmt.Errorf("arrays differ in length. %d != %d", len(a), len(b)) } for i, v := range a { if v != b[i] { - return fmt.Errorf("Arrays differ at index: %d", i) + return fmt.Errorf("arrays differ at index: %d", i) } } return nil diff --git a/unixfs/unixfs.go b/unixfs/unixfs.go index d04a461ed09..654de7ff82e 100644 --- a/unixfs/unixfs.go +++ b/unixfs/unixfs.go @@ -129,13 +129,13 @@ func DataSize(data []byte) (uint64, error) { switch pbdata.GetType() { case pb.Data_Directory: - return 0, errors.New("Cant get data size of directory") + return 0, errors.New("can't get data size of directory") case pb.Data_File: return pbdata.GetFilesize(), nil case pb.Data_Raw: return uint64(len(pbdata.GetData())), nil default: - return 0, errors.New("Unrecognized node data type") + return 0, errors.New("unrecognized node data type") } }