@cryptotaxi247 / kubo / commits / 2ee5cfb90

fix error style

License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>

Łukasz Magiera committed Mar 18, 2018 at 19:54 UTC 2ee5cfb90f97aa7bab747808ffce219a54f2adf4
44 files changed +71 -69
cmd/ipfs/init.go
+1 -1
@@ -82,7 +82,7 @@ environment variable:
82 Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) {
83 cctx := env.(*oldcmds.Context)
84 if cctx.Online {
85 - res.SetError(errors.New("init must be run offline only!"), cmdkit.ErrNormal)
85 + res.SetError(errors.New("init must be run offline only"), cmdkit.ErrNormal)
86 return
87 }
88
cmd/seccat/seccat.go
+1 -1
@@ -113,7 +113,7 @@ func main() {
113
114 func setupPeer(a args) (peer.ID, pstore.Peerstore, error) {
115 if a.keybits < 1024 {
116 - return "", nil, errors.New("Bitsize less than 1024 is considered unsafe.")
116 + return "", nil, errors.New("bitsize less than 1024 is considered unsafe")
117 }
118
119 out("generating key pair...")
commands/legacy/request.go
+3 -3
@@ -173,20 +173,20 @@ func convertOptions(req *cmds.Request) error {
173 if len(str) == 0 {
174 value = "empty value"
175 }
176 - return fmt.Errorf("Could not convert %q to type %q (for option %q)",
176 + return fmt.Errorf("could not convert %q to type %q (for option %q)",
177 value, opt.Type().String(), "-"+k)
178 }
179 req.Options[k] = val
180
181 } else {
182 - return fmt.Errorf("Option %q should be type %q, but got type %q",
182 + return fmt.Errorf("option %q should be type %q, but got type %q",
183 k, opt.Type().String(), kind.String())
184 }
185 }
186
187 for _, name := range opt.Names() {
188 if _, ok := req.Options[name]; name != k && ok {
189 - return fmt.Errorf("Duplicate command options were provided (%q and %q)",
189 + return fmt.Errorf("duplicate command options were provided (%q and %q)",
190 k, name)
191 }
192 }
core/commands/cat.go
+2 -2
@@ -44,7 +44,7 @@ var CatCmd = &cmds.Command{
44
45 offset, _ := req.Options["offset"].(int)
46 if offset < 0 {
47 - res.SetError(fmt.Errorf("Cannot specify negative offset."), cmdkit.ErrNormal)
47 + res.SetError(fmt.Errorf("cannot specify negative offset"), cmdkit.ErrNormal)
48 return
49 }
50
@@ -54,7 +54,7 @@ var CatCmd = &cmds.Command{
54 return
55 }
56 if max < 0 {
57 - res.SetError(fmt.Errorf("Cannot specify negative length."), cmdkit.ErrNormal)
57 + res.SetError(fmt.Errorf("cannot specify negative length"), cmdkit.ErrNormal)
58 return
59 }
60 if !found {
core/commands/config.go
+2 -2
@@ -354,7 +354,7 @@ func transformConfig(configRoot string, configName string, transformer config.Tr
354 func getConfig(r repo.Repo, key string) (*ConfigField, error) {
355 value, err := r.GetConfigKey(key)
356 if err != nil {
357 - return nil, fmt.Errorf("Failed to get config value: %q", err)
357 + return nil, fmt.Errorf("failed to get config value: %q", err)
358 }
359 return &ConfigField{
360 Key: key,
@@ -392,7 +392,7 @@ func replaceConfig(r repo.Repo, file io.Reader) error {
392
393 keyF, err := getConfig(r, config.PrivKeySelector)
394 if err != nil {
395 - return fmt.Errorf("Failed to get PrivKey")
395 + return fmt.Errorf("failed to get PrivKey")
396 }
397
398 pkstr, ok := keyF.Value.(string)
core/commands/dht.go
+1 -1
@@ -170,7 +170,7 @@ var findProvidersDhtCmd = &cmds.Command{
170 return
171 }
172 if numProviders < 1 {
173 - res.SetError(fmt.Errorf("Number of providers must be greater than 0"), cmdkit.ErrNormal)
173 + res.SetError(fmt.Errorf("number of providers must be greater than 0"), cmdkit.ErrNormal)
174 return
175 }
176
core/commands/get.go
+1 -1
@@ -21,7 +21,7 @@ import (
21 "gx/ipfs/QmfAkMSt9Fwzk48QDJecPcwCUjnf2uG7MLnmCGTp4C6ouL/go-ipfs-cmds"
22 )
23
24 -var ErrInvalidCompressionLevel = errors.New("Compression level must be between 1 and 9")
24 +var ErrInvalidCompressionLevel = errors.New("compression level must be between 1 and 9")
25
26 var GetCmd = &cmds.Command{
27 Helptext: cmdkit.HelpText{
core/commands/id.go
+1 -1
@@ -156,7 +156,7 @@ EXAMPLE:
156
157 func printPeer(ps pstore.Peerstore, p peer.ID) (interface{}, error) {
158 if p == "" {
159 - return nil, errors.New("Attempted to print nil peer!")
159 + return nil, errors.New("attempted to print nil peer")
160 }
161
162 info := new(IdOutput)
core/commands/object/object.go
+1 -1
@@ -665,7 +665,7 @@ func deserializeNode(nd *Node, dataFieldEncoding string) (*dag.ProtoNode, error)
665 }
666 dagnode.SetData(data)
667 default:
668 - return nil, fmt.Errorf("Unkown data field encoding")
668 + return nil, fmt.Errorf("unkown data field encoding")
669 }
670
671 links := make([]*ipld.Link, len(nd.Links))
core/commands/pin.go
+2 -2
@@ -297,7 +297,7 @@ Example:
297 switch typeStr {
298 case "all", "direct", "indirect", "recursive":
299 default:
300 - err = fmt.Errorf("Invalid type '%s', must be one of {direct, indirect, recursive, all}", typeStr)
300 + err = fmt.Errorf("invalid type '%s', must be one of {direct, indirect, recursive, all}", typeStr)
301 res.SetError(err, cmdkit.ErrClient)
302 return
303 }
@@ -447,7 +447,7 @@ var verifyPinCmd = &cmds.Command{
447 quiet, _, _ := res.Request().Option("quiet").Bool()
448
449 if verbose && quiet {
450 - res.SetError(fmt.Errorf("The --verbose and --quiet options can not be used at the same time"), cmdkit.ErrNormal)
450 + res.SetError(fmt.Errorf("the --verbose and --quiet options can not be used at the same time"), cmdkit.ErrNormal)
451 }
452
453 opts := pinVerifyOpts{
core/commands/publish.go
+1 -1
@@ -19,7 +19,7 @@ import (
19 "gx/ipfs/QmceUdzxkimdYsgtX733uNgzf1DLHyBKN6ehGSp85ayppM/go-ipfs-cmdkit"
20 )
21
22 -var errNotOnline = errors.New("This command must be run in online mode. Try running 'ipfs daemon' first.")
22 +var errNotOnline = errors.New("this command must be run in online mode. Try running 'ipfs daemon' first")
23
24 var PublishCmd = &cmds.Command{
25 Helptext: cmdkit.HelpText{
core/commands/pubsub.go
+2 -2
@@ -86,7 +86,7 @@ This command outputs data in the following encodings:
86 }
87
88 if n.Floodsub == nil {
89 - res.SetError(fmt.Errorf("experimental pubsub feature not enabled. Run daemon with --enable-pubsub-experiment to use."), cmdkit.ErrNormal)
89 + res.SetError(fmt.Errorf("experimental pubsub feature not enabled. Run daemon with --enable-pubsub-experiment to use"), cmdkit.ErrNormal)
90 return
91 }
92
@@ -323,7 +323,7 @@ To use, the daemon must be run with '--enable-pubsub-experiment'.
323 }
324
325 if n.Floodsub == nil {
326 - res.SetError(fmt.Errorf("experimental pubsub feature not enabled. Run daemon with --enable-pubsub-experiment to use."), cmdkit.ErrNormal)
326 + res.SetError(fmt.Errorf("experimental pubsub feature not enabled. Run daemon with --enable-pubsub-experiment to use"), cmdkit.ErrNormal)
327 return
328 }
329
core/core.go
+2 -2
@@ -696,7 +696,7 @@ func (n *IpfsNode) GetKey(name string) (ic.PrivKey, error) {
696
697 func (n *IpfsNode) LoadPrivateKey() error {
698 if n.Identity == "" || n.Peerstore == nil {
699 - return errors.New("loaded private key out of order.")
699 + return errors.New("loaded private key out of order")
700 }
701
702 if n.PrivateKey != nil {
@@ -826,7 +826,7 @@ func listenAddresses(cfg *config.Config) ([]ma.Multiaddr, error) {
826 for _, addr := range cfg.Addresses.Swarm {
827 maddr, err := ma.NewMultiaddr(addr)
828 if err != nil {
829 - return nil, fmt.Errorf("Failure to parse config.Addresses.Swarm: %s", cfg.Addresses.Swarm)
829 + return nil, fmt.Errorf("failure to parse config.Addresses.Swarm: %s", cfg.Addresses.Swarm)
830 }
831 listen = append(listen, maddr)
832 }
core/coreapi/object.go
+1 -1
@@ -300,7 +300,7 @@ func deserializeNode(nd *Node, dataFieldEncoding string) (*dag.ProtoNode, error)
300 }
301 dagnode.SetData(data)
302 default:
303 - return nil, fmt.Errorf("Unkown data field encoding")
303 + return nil, fmt.Errorf("unkown data field encoding")
304 }
305
306 links := make([]*ipld.Link, len(nd.Links))
core/corerepo/gc.go
+1 -1
@@ -18,7 +18,7 @@ import (
18
19 var log = logging.Logger("corerepo")
20
21 -var ErrMaxStorageExceeded = errors.New("Maximum storage limit exceeded. Maybe unpin some files?")
21 +var ErrMaxStorageExceeded = errors.New("maximum storage limit exceeded. Try to unpin some files")
22
23 type GC struct {
24 Node *core.IpfsNode
exchange/bitswap/testnet/virtual.go
+2 -2
@@ -88,7 +88,7 @@ func (n *network) SendMessage(
88
89 receiver, ok := n.clients[to]
90 if !ok {
91 - return errors.New("Cannot locate peer on network")
91 + return errors.New("cannot locate peer on network")
92 }
93
94 // nb: terminate the context since the context wouldn't actually be passed
@@ -107,7 +107,7 @@ func (n *network) SendMessage(
107 func (n *network) deliver(
108 r bsnet.Receiver, from peer.ID, message bsmsg.BitSwapMessage) error {
109 if message == nil || from == "" {
110 - return errors.New("Invalid input")
110 + return errors.New("invalid input")
111 }
112
113 n.delay.Wait()
exchange/reprovide/reprovide.go
+1 -1
@@ -82,7 +82,7 @@ func (rp *Reprovider) Run(tick time.Duration) {
82 func (rp *Reprovider) Reprovide() error {
83 keychan, err := rp.keyProvider(rp.ctx)
84 if err != nil {
85 - return fmt.Errorf("Failed to get key chan: %s", err)
85 + return fmt.Errorf("failed to get key chan: %s", err)
86 }
87 for c := range keychan {
88 // hash security
fuse/ipns/ipns_unix.go
+1 -1
@@ -564,7 +564,7 @@ func (dir *Directory) Rename(ctx context.Context, req *fuse.RenameRequest, newDi
564 return fuse.EPERM
565 default:
566 log.Error("Unknown node type for rename target dir!")
567 - return errors.New("Unknown fs node type!")
567 + return errors.New("unknown fs node type")
568 }
569 return nil
570 }
fuse/mount/fuse.go
+1 -1
@@ -81,7 +81,7 @@ func (m *mount) mount() error {
81 // wait for the mount process to be done, or timed out.
82 select {
83 case <-time.After(MountTimeout):
84 - return fmt.Errorf("Mounting %s timed out.", m.MountPoint())
84 + return fmt.Errorf("mounting %s timed out", m.MountPoint())
85 case err := <-errs:
86 return err
87 case <-m.fuseConn.Ready:
fuse/mount/mount.go
+1 -1
@@ -82,7 +82,7 @@ func ForceUnmountManyTimes(m Mount, attempts int) error {
82
83 <-time.After(time.Millisecond * 500)
84 }
85 - return fmt.Errorf("Unmount %s failed after 10 seconds of trying.", m.MountPoint())
85 + return fmt.Errorf("unmount %s failed after 10 seconds of trying", m.MountPoint())
86 }
87
88 type closer struct {
fuse/readonly/ipfs_test.go
+1 -1
@@ -183,7 +183,7 @@ func TestIpfsStressRead(t *testing.T) {
183 }
184
185 if !bytes.Equal(rbuf, data) {
186 - errs <- errors.New("Incorrect Read!")
186 + errs <- errors.New("incorrect read")
187 }
188 }
189 }()
fuse/readonly/readonly_unix.go
+1 -1
@@ -135,7 +135,7 @@ func (s *Node) Attr(ctx context.Context, a *fuse.Attr) error {
135 a.Mode = 0777 | os.ModeSymlink
136 a.Size = uint64(len(s.cached.GetData()))
137 default:
138 - return fmt.Errorf("Invalid data type - %s", s.cached.GetType())
138 + return fmt.Errorf("invalid data type - %s", s.cached.GetType())
139 }
140 return nil
141 }
importer/balanced/balanced_test.go
+2 -2
@@ -103,11 +103,11 @@ func TestTwoChunks(t *testing.T) {
103
104 func arrComp(a, b []byte) error {
105 if len(a) != len(b) {
106 - return fmt.Errorf("Arrays differ in length. %d != %d", len(a), len(b))
106 + return fmt.Errorf("arrays differ in length. %d != %d", len(a), len(b))
107 }
108 for i, v := range a {
109 if v != b[i] {
110 - return fmt.Errorf("Arrays differ at index: %d", i)
110 + return fmt.Errorf("arrays differ at index: %d", i)
111 }
112 }
113 return nil
importer/trickle/trickle_test.go
+2 -2
@@ -141,11 +141,11 @@ func testBuilderConsistency(t *testing.T, rawLeaves UseRawLeaves) {
141
142 func arrComp(a, b []byte) error {
143 if len(a) != len(b) {
144 - return fmt.Errorf("Arrays differ in length. %d != %d", len(a), len(b))
144 + return fmt.Errorf("arrays differ in length. %d != %d", len(a), len(b))
145 }
146 for i, v := range a {
147 if v != b[i] {
148 - return fmt.Errorf("Arrays differ at index: %d", i)
148 + return fmt.Errorf("arrays differ at index: %d", i)
149 }
150 }
151 return nil
importer/trickle/trickledag.go
+1 -1
@@ -283,7 +283,7 @@ func verifyTDagRec(n ipld.Node, depth int, p VerifyParams) error {
283 }
284
285 if pbn.GetType() != ft.TRaw {
286 - return errors.New("Expected raw block")
286 + return errors.New("expected raw block")
287 }
288
289 if p.RawLeaves {
keystore/keystore_test.go
+1 -1
@@ -250,7 +250,7 @@ func assertDirContents(dir string, exp []string) error {
250 }
251
252 if len(finfos) != len(exp) {
253 - return fmt.Errorf("Expected %d directory entries", len(exp))
253 + return fmt.Errorf("expected %d directory entries", len(exp))
254 }
255
256 var names []string
merkledag/coding.go
+5 -5
@@ -21,7 +21,7 @@ import (
21 func (n *ProtoNode) unmarshal(encoded []byte) error {
22 var pbn pb.PBNode
23 if err := pbn.Unmarshal(encoded); err != nil {
24 - return fmt.Errorf("Unmarshal failed. %v", err)
24 + return fmt.Errorf("unmarshal failed. %v", err)
25 }
26
27 pbnl := pbn.GetLinks()
@@ -30,7 +30,7 @@ func (n *ProtoNode) unmarshal(encoded []byte) error {
30 n.links[i] = &ipld.Link{Name: l.GetName(), Size: l.GetTsize()}
31 c, err := cid.Cast(l.GetHash())
32 if err != nil {
33 - return fmt.Errorf("Link hash #%d is not valid multihash. %v", i, err)
33 + return fmt.Errorf("link hash #%d is not valid multihash. %v", i, err)
34 }
35 n.links[i].Cid = c
36 }
@@ -47,7 +47,7 @@ func (n *ProtoNode) Marshal() ([]byte, error) {
47 pbn := n.getPBNode()
48 data, err := pbn.Marshal()
49 if err != nil {
50 - return data, fmt.Errorf("Marshal failed. %v", err)
50 + return data, fmt.Errorf("marshal failed. %v", err)
51 }
52 return data, nil
53 }
@@ -123,9 +123,9 @@ func DecodeProtobufBlock(b blocks.Block) (ipld.Node, error) {
123 decnd, err := DecodeProtobuf(b.RawData())
124 if err != nil {
125 if strings.Contains(err.Error(), "Unmarshal failed") {
126 - return nil, fmt.Errorf("The block referred to by '%s' was not a valid merkledag node", c)
126 + return nil, fmt.Errorf("the block referred to by '%s' was not a valid merkledag node", c)
127 }
128 - return nil, fmt.Errorf("Failed to decode Protocol Buffers: %v", err)
128 + return nil, fmt.Errorf("failed to decode Protocol Buffers: %v", err)
129 }
130
131 decnd.cached = c
merkledag/merkledag.go
+1 -1
@@ -74,7 +74,7 @@ func (n *dagService) Get(ctx context.Context, c *cid.Cid) (ipld.Node, error) {
74 if err == bserv.ErrNotFound {
75 return nil, ipld.ErrNotFound
76 }
77 - return nil, fmt.Errorf("Failed to get block for %s: %v", c, err)
77 + return nil, fmt.Errorf("failed to get block for %s: %v", c, err)
78 }
79
80 return ipld.Decode(b)
merkledag/merkledag_test.go
+1 -1
@@ -239,7 +239,7 @@ func runBatchFetchTest(t *testing.T, read io.Reader) {
239 }
240
241 if !bytes.Equal(datagot, expected) {
242 - errs <- errors.New("Got bad data back!")
242 + errs <- errors.New("got bad data back")
243 }
244 }(i)
245 }
mfs/mfs_test.go
+5 -5
@@ -108,7 +108,7 @@ func assertDirAtPath(root *Directory, pth string, children []string) error {
108 sort.Strings(children)
109 sort.Strings(names)
110 if !compStrArrs(children, names) {
111 - return errors.New("directories children did not match!")
111 + return errors.New("directories children did not match")
112 }
113
114 return nil
@@ -158,7 +158,7 @@ func assertFileAtPath(ds ipld.DAGService, root *Directory, expn ipld.Node, pth s
158
159 file, ok := finaln.(*File)
160 if !ok {
161 - return fmt.Errorf("%s was not a file!", pth)
161 + return fmt.Errorf("%s was not a file", pth)
162 }
163
164 rfd, err := file.Open(OpenReadOnly, false)
@@ -177,7 +177,7 @@ func assertFileAtPath(ds ipld.DAGService, root *Directory, expn ipld.Node, pth s
177 }
178
179 if !bytes.Equal(out, expbytes) {
180 - return fmt.Errorf("Incorrect data at path!")
180 + return fmt.Errorf("incorrect data at path")
181 }
182 return nil
183 }
@@ -616,7 +616,7 @@ func randomFile(d *Directory) (*File, error) {
616
617 fi, ok := fsn.(*File)
618 if !ok {
619 - return nil, errors.New("file wasnt a file, race?")
619 + return nil, errors.New("file wasn't a file, race?")
620 }
621
622 return fi, nil
@@ -889,7 +889,7 @@ func readFile(rt *Root, path string, offset int64, buf []byte) error {
889 return err
890 }
891 if nread != len(buf) {
892 - return fmt.Errorf("didnt read enough!")
892 + return fmt.Errorf("didn't read enough")
893 }
894
895 return fd.Close()
namesys/dns_test.go
+1 -1
@@ -14,7 +14,7 @@ type mockDNS struct {
14 func (m *mockDNS) lookupTXT(name string) (txt []string, err error) {
15 txt, ok := m.entries[name]
16 if !ok {
17 - return nil, fmt.Errorf("No TXT entry for %s", name)
17 + return nil, fmt.Errorf("no TXT entry for %s", name)
18 }
19 return txt, nil
20 }
namesys/interface.go
+4 -3
@@ -37,18 +37,19 @@ import (
37
38 opts "github.com/ipfs/go-ipfs/namesys/opts"
39 path "github.com/ipfs/go-ipfs/path"
40 +
41 ci "gx/ipfs/QmaPbCnUMBohSGo3KnxEa2bHqyJVVeEEcwtqJAYxerieBo/go-libp2p-crypto"
42 )
43
44 // ErrResolveFailed signals an error when attempting to resolve.
44 -var ErrResolveFailed = errors.New("Could not resolve name.")
45 +var ErrResolveFailed = errors.New("could not resolve name")
46
47 // ErrResolveRecursion signals a recursion-depth limit.
48 var ErrResolveRecursion = errors.New(
48 - "Could not resolve name (recursion limit exceeded).")
49 + "could not resolve name (recursion limit exceeded)")
50
51 // ErrPublishFailed signals an error when attempting to publish.
51 -var ErrPublishFailed = errors.New("Could not publish name.")
52 +var ErrPublishFailed = errors.New("could not publish name")
53
54 // Namesys represents a cohesive name publishing and resolving system.
55 //
namesys/namesys_test.go
+1 -1
@@ -24,7 +24,7 @@ func testResolution(t *testing.T, resolver Resolver, name string, depth uint, ex
24 p, err := resolver.Resolve(context.Background(), name, opts.Depth(depth))
25 if err != expError {
26 t.Fatal(fmt.Errorf(
27 - "Expected %s with a depth of %d to have a '%s' error, but got '%s'",
27 + "expected %s with a depth of %d to have a '%s' error, but got '%s'",
28 name, depth, expError, err))
29 }
30 if p.String() != expected {
namesys/pubsub.go
+1 -1
@@ -203,7 +203,7 @@ func (r *PubsubResolver) resolveOnce(ctx context.Context, name string, options *
203
204 id := peer.ID(hash)
205 if r.host.Peerstore().PrivKey(id) != nil {
206 - return "", errors.New("Cannot resolve own name through pubsub")
206 + return "", errors.New("cannot resolve own name through pubsub")
207 }
208
209 pubk := id.ExtractPublicKey()
namesys/resolve_test.go
+1 -1
@@ -131,7 +131,7 @@ func verifyCanResolve(r Resolver, name string, exp path.Path) error {
131 }
132
133 if res != exp {
134 - return errors.New("got back wrong record!")
134 + return errors.New("got back wrong record")
135 }
136
137 return nil
pin/pin.go
+1 -1
@@ -305,7 +305,7 @@ func (p *pinner) isPinnedWithType(c *cid.Cid, mode Mode) (string, bool, error) {
305 switch mode {
306 case Any, Direct, Indirect, Recursive, Internal:
307 default:
308 - err := fmt.Errorf("Invalid Pin Mode '%d', must be one of {%d, %d, %d, %d, %d}",
308 + err := fmt.Errorf("invalid Pin Mode '%d', must be one of {%d, %d, %d, %d, %d}",
309 mode, Direct, Indirect, Recursive, Internal, Any)
310 return "", false, err
311 }
repo/config/config.go
+2 -2
@@ -93,7 +93,7 @@ func FromMap(v map[string]interface{}) (*Config, error) {
93 }
94 var conf Config
95 if err := json.NewDecoder(buf).Decode(&conf); err != nil {
96 - return nil, fmt.Errorf("Failure to decode config: %s", err)
96 + return nil, fmt.Errorf("failure to decode config: %s", err)
97 }
98 return &conf, nil
99 }
@@ -105,7 +105,7 @@ func ToMap(conf *Config) (map[string]interface{}, error) {
105 }
106 var m map[string]interface{}
107 if err := json.NewDecoder(buf).Decode(&m); err != nil {
108 - return nil, fmt.Errorf("Failure to decode config: %s", err)
108 + return nil, fmt.Errorf("failure to decode config: %s", err)
109 }
110 return m, nil
111 }
repo/config/init.go
+1 -1
@@ -153,7 +153,7 @@ func identityConfig(out io.Writer, nbits int) (Identity, error) {
153 // TODO guard higher up
154 ident := Identity{}
155 if nbits < 1024 {
156 - return ident, errors.New("Bitsize less than 1024 is considered unsafe.")
156 + return ident, errors.New("bitsize less than 1024 is considered unsafe")
157 }
158
159 fmt.Fprintf(out, "generating %v-bit RSA keypair...", nbits)
repo/fsrepo/fsrepo.go
+3 -3
@@ -50,7 +50,7 @@ See https://github.com/ipfs/fs-repo-migrations/blob/master/run.md for details.`
50 var (
51 ErrNoVersion = errors.New("no version file found, please run 0-to-1 migration tool.\n" + migrationInstructions)
52 ErrOldRepo = errors.New("ipfs repo found in old '~/.go-ipfs' location, please run migration tool.\n" + migrationInstructions)
53 - ErrNeedMigration = errors.New("ipfs repo needs migration.")
53 + ErrNeedMigration = errors.New("ipfs repo needs migration")
54 )
55
56 type NoRepoError struct {
@@ -412,7 +412,7 @@ func (r *FSRepo) openDatastore() error {
412 return err
413 }
414 if oldSpec != spec.String() {
415 - return fmt.Errorf("Datastore configuration of '%s' does not match what is on disk '%s'",
415 + return fmt.Errorf("datastore configuration of '%s' does not match what is on disk '%s'",
416 oldSpec, spec.String())
417 }
418
@@ -633,7 +633,7 @@ func (r *FSRepo) SetConfigKey(key string, value interface{}) error {
633 default:
634 }
635 if !ok {
636 - return fmt.Errorf("Wrong config type, expected %T", oldValue)
636 + return fmt.Errorf("wrong config type, expected %T", oldValue)
637 }
638 }
639
repo/fsrepo/serialize/serialize.go
+2 -1
@@ -9,6 +9,7 @@ import (
9 "path/filepath"
10
11 "github.com/ipfs/go-ipfs/repo/config"
12 +
13 "gx/ipfs/QmNiJuT8Ja3hMVpBHXv3Q6dwmperaQ6JjLtpMQgMCD7xvx/go-ipfs-util"
14 "gx/ipfs/QmdYwCmx8pZRkzdcd8MhmLJqYVoVTC1aGsy5Q4reMGLNLg/atomicfile"
15 )
@@ -21,7 +22,7 @@ func ReadConfigFile(filename string, cfg interface{}) error {
22 }
23 defer f.Close()
24 if err := json.NewDecoder(f).Decode(cfg); err != nil {
24 - return fmt.Errorf("Failure to decode config: %s", err)
25 + return fmt.Errorf("failure to decode config: %s", err)
26 }
27 return nil
28 }
thirdparty/pollEndpoint/main.go
+1 -1
@@ -82,7 +82,7 @@ func checkOK(resp *http.Response, err error) error {
82 if err != nil {
83 fmt.Fprintf(os.Stderr, "pollEndpoint: ioutil.ReadAll() Error: %s", err)
84 }
85 - return fmt.Errorf("Response not OK. %d %s %q", resp.StatusCode, resp.Status, string(body))
85 + return fmt.Errorf("response not OK. %d %s %q", resp.StatusCode, resp.Status, string(body))
86 }
87 return err
88 }
unixfs/io/pbdagreader.go
+1 -1
@@ -238,7 +238,7 @@ func (dr *PBDagReader) Seek(offset int64, whence int) (int64, error) {
238 switch whence {
239 case io.SeekStart:
240 if offset < 0 {
241 - return -1, errors.New("Invalid offset")
241 + return -1, errors.New("invalid offset")
242 }
243 if offset == dr.offset {
244 return offset, nil
unixfs/test/utils.go
+2 -2
@@ -95,11 +95,11 @@ func GetRandomNode(t testing.TB, dserv ipld.DAGService, size int64, opts NodeOpt
95 // ArrComp checks if two byte slices are the same.
96 func ArrComp(a, b []byte) error {
97 if len(a) != len(b) {
98 - return fmt.Errorf("Arrays differ in length. %d != %d", len(a), len(b))
98 + return fmt.Errorf("arrays differ in length. %d != %d", len(a), len(b))
99 }
100 for i, v := range a {
101 if v != b[i] {
102 - return fmt.Errorf("Arrays differ at index: %d", i)
102 + return fmt.Errorf("arrays differ at index: %d", i)
103 }
104 }
105 return nil
unixfs/unixfs.go
+2 -2
@@ -129,13 +129,13 @@ func DataSize(data []byte) (uint64, error) {
129
130 switch pbdata.GetType() {
131 case pb.Data_Directory:
132 - return 0, errors.New("Cant get data size of directory")
132 + return 0, errors.New("can't get data size of directory")
133 case pb.Data_File:
134 return pbdata.GetFilesize(), nil
135 case pb.Data_Raw:
136 return uint64(len(pbdata.GetData())), nil
137 default:
138 - return 0, errors.New("Unrecognized node data type")
138 + return 0, errors.New("unrecognized node data type")
139 }
140 }
141