fix linting
License: MIT Signed-off-by: Michael Muré <batolettre@gmail.com>
Michael Muré committed
Feb 2, 2018 at 13:30 UTC
189c905f40a18b0b7195f313a4ef2ecd797700f2
1 file changed
+11
-10
core/commands/files.go
+11
-10
@@ -33,6 +33,7 @@ import (
33
34
var flog = logging.Logger("cmds/files")
35
36
+// FilesCmd is the 'ipfs files' command
37
var FilesCmd = &cmds.Command{
38
Helptext: cmdkit.HelpText{
39
Tagline: "Interact with unixfs files.",
@@ -70,7 +71,7 @@ operations.
71
var cidVersionOption = cmdkit.IntOption("cid-version", "cid-ver", "Cid version to use. (experimental)")
72
var hashOption = cmdkit.StringOption("hash", "Hash function to use. Will set Cid version to 1 if used. (experimental)")
73
73
-var formatError = errors.New("Format was set by multiple options. Only one format option is allowed")
74
+var errFormat = errors.New("format was set by multiple options. Only one format option is allowed")
75
76
type statOutput struct {
77
Hash string
@@ -196,7 +197,7 @@ func statGetFormatOptions(req *cmds.Request) (string, error) {
197
format, _ := req.Options["format"].(string)
198
199
if moreThanOne(hash, size, format != defaultStatFormat) {
199
- return "", formatError
200
+ return "", errFormat
201
}
202
203
if hash {
@@ -531,7 +532,7 @@ Examples:
532
533
fi, ok := fsn.(*mfs.File)
534
if !ok {
534
- res.SetError(fmt.Errorf("%s was not a file.", path), cmdkit.ErrNormal)
535
+ res.SetError(fmt.Errorf("%s was not a file", path), cmdkit.ErrNormal)
536
return
537
}
538
@@ -549,7 +550,7 @@ Examples:
550
return
551
}
552
if offset < 0 {
552
- res.SetError(fmt.Errorf("Cannot specify negative offset."), cmdkit.ErrNormal)
553
+ res.SetError(fmt.Errorf("cannot specify negative offset"), cmdkit.ErrNormal)
554
return
555
}
556
@@ -560,7 +561,7 @@ Examples:
561
}
562
563
if int64(offset) > filen {
563
- res.SetError(fmt.Errorf("Offset was past end of file (%d > %d).", offset, filen), cmdkit.ErrNormal)
564
+ res.SetError(fmt.Errorf("offset was past end of file (%d > %d)", offset, filen), cmdkit.ErrNormal)
565
return
566
}
567
@@ -578,7 +579,7 @@ Examples:
579
}
580
if found {
581
if count < 0 {
581
- res.SetError(fmt.Errorf("Cannot specify negative 'count'."), cmdkit.ErrNormal)
582
+ res.SetError(fmt.Errorf("cannot specify negative 'count'"), cmdkit.ErrNormal)
583
return
584
}
585
r = io.LimitReader(r, int64(count))
@@ -1013,7 +1014,7 @@ Remove files or directories.
1014
1015
pdir, ok := parent.(*mfs.Directory)
1016
if !ok {
1016
- res.SetError(fmt.Errorf("No such file or directory: %s", path), cmdkit.ErrNormal)
1017
+ res.SetError(fmt.Errorf("no such file or directory: %s", path), cmdkit.ErrNormal)
1018
return
1019
}
1020
@@ -1137,7 +1138,7 @@ func getFileHandle(r *mfs.Root, path string, create bool, prefix *cid.Prefix) (*
1138
1139
fi, ok := fsn.(*mfs.File)
1140
if !ok {
1140
- return nil, errors.New("Expected *mfs.File, didnt get it. This is likely a race condition.")
1141
+ return nil, errors.New("expected *mfs.File, didnt get it. This is likely a race condition")
1142
}
1143
return fi, nil
1144
@@ -1148,11 +1149,11 @@ func getFileHandle(r *mfs.Root, path string, create bool, prefix *cid.Prefix) (*
1149
1150
func checkPath(p string) (string, error) {
1151
if len(p) == 0 {
1151
- return "", fmt.Errorf("Paths must not be empty.")
1152
+ return "", fmt.Errorf("paths must not be empty")
1153
}
1154
1155
if p[0] != '/' {
1155
- return "", fmt.Errorf("Paths must start with a leading slash.")
1156
+ return "", fmt.Errorf("paths must start with a leading slash")
1157
}
1158
1159
cleaned := gopath.Clean(p)