Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
189c905f
Unverified
Commit
189c905f
authored
Feb 02, 2018
by
Michael Muré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix linting
License: MIT Signed-off-by:
Michael Muré
<
batolettre@gmail.com
>
parent
eeb15db1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
10 deletions
+11
-10
core/commands/files.go
core/commands/files.go
+11
-10
No files found.
core/commands/files.go
View file @
189c905f
...
...
@@ -33,6 +33,7 @@ import (
var
flog
=
logging
.
Logger
(
"cmds/files"
)
// FilesCmd is the 'ipfs files' command
var
FilesCmd
=
&
cmds
.
Command
{
Helptext
:
cmdkit
.
HelpText
{
Tagline
:
"Interact with unixfs files."
,
...
...
@@ -70,7 +71,7 @@ operations.
var
cidVersionOption
=
cmdkit
.
IntOption
(
"cid-version"
,
"cid-ver"
,
"Cid version to use. (experimental)"
)
var
hashOption
=
cmdkit
.
StringOption
(
"hash"
,
"Hash function to use. Will set Cid version to 1 if used. (experimental)"
)
var
f
ormat
Error
=
errors
.
New
(
"
F
ormat was set by multiple options. Only one format option is allowed"
)
var
errF
ormat
=
errors
.
New
(
"
f
ormat was set by multiple options. Only one format option is allowed"
)
type
statOutput
struct
{
Hash
string
...
...
@@ -196,7 +197,7 @@ func statGetFormatOptions(req *cmds.Request) (string, error) {
format
,
_
:=
req
.
Options
[
"format"
]
.
(
string
)
if
moreThanOne
(
hash
,
size
,
format
!=
defaultStatFormat
)
{
return
""
,
f
ormat
Error
return
""
,
errF
ormat
}
if
hash
{
...
...
@@ -531,7 +532,7 @@ Examples:
fi
,
ok
:=
fsn
.
(
*
mfs
.
File
)
if
!
ok
{
res
.
SetError
(
fmt
.
Errorf
(
"%s was not a file
.
"
,
path
),
cmdkit
.
ErrNormal
)
res
.
SetError
(
fmt
.
Errorf
(
"%s was not a file"
,
path
),
cmdkit
.
ErrNormal
)
return
}
...
...
@@ -549,7 +550,7 @@ Examples:
return
}
if
offset
<
0
{
res
.
SetError
(
fmt
.
Errorf
(
"
C
annot specify negative offset
.
"
),
cmdkit
.
ErrNormal
)
res
.
SetError
(
fmt
.
Errorf
(
"
c
annot specify negative offset"
),
cmdkit
.
ErrNormal
)
return
}
...
...
@@ -560,7 +561,7 @@ Examples:
}
if
int64
(
offset
)
>
filen
{
res
.
SetError
(
fmt
.
Errorf
(
"
O
ffset was past end of file (%d > %d)
.
"
,
offset
,
filen
),
cmdkit
.
ErrNormal
)
res
.
SetError
(
fmt
.
Errorf
(
"
o
ffset was past end of file (%d > %d)"
,
offset
,
filen
),
cmdkit
.
ErrNormal
)
return
}
...
...
@@ -578,7 +579,7 @@ Examples:
}
if
found
{
if
count
<
0
{
res
.
SetError
(
fmt
.
Errorf
(
"
C
annot specify negative 'count'
.
"
),
cmdkit
.
ErrNormal
)
res
.
SetError
(
fmt
.
Errorf
(
"
c
annot specify negative 'count'"
),
cmdkit
.
ErrNormal
)
return
}
r
=
io
.
LimitReader
(
r
,
int64
(
count
))
...
...
@@ -1013,7 +1014,7 @@ Remove files or directories.
pdir
,
ok
:=
parent
.
(
*
mfs
.
Directory
)
if
!
ok
{
res
.
SetError
(
fmt
.
Errorf
(
"
N
o such file or directory: %s"
,
path
),
cmdkit
.
ErrNormal
)
res
.
SetError
(
fmt
.
Errorf
(
"
n
o such file or directory: %s"
,
path
),
cmdkit
.
ErrNormal
)
return
}
...
...
@@ -1137,7 +1138,7 @@ func getFileHandle(r *mfs.Root, path string, create bool, prefix *cid.Prefix) (*
fi
,
ok
:=
fsn
.
(
*
mfs
.
File
)
if
!
ok
{
return
nil
,
errors
.
New
(
"
E
xpected *mfs.File, didnt get it. This is likely a race condition
.
"
)
return
nil
,
errors
.
New
(
"
e
xpected *mfs.File, didnt get it. This is likely a race condition"
)
}
return
fi
,
nil
...
...
@@ -1148,11 +1149,11 @@ func getFileHandle(r *mfs.Root, path string, create bool, prefix *cid.Prefix) (*
func
checkPath
(
p
string
)
(
string
,
error
)
{
if
len
(
p
)
==
0
{
return
""
,
fmt
.
Errorf
(
"
P
aths must not be empty
.
"
)
return
""
,
fmt
.
Errorf
(
"
p
aths must not be empty"
)
}
if
p
[
0
]
!=
'/'
{
return
""
,
fmt
.
Errorf
(
"
P
aths must start with a leading slash
.
"
)
return
""
,
fmt
.
Errorf
(
"
p
aths must start with a leading slash"
)
}
cleaned
:=
gopath
.
Clean
(
p
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment