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
29862f02
Commit
29862f02
authored
Feb 25, 2015
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #795 from jbenet/fix/object-stat
fix panic in offline calls of 'ipfs object stat'
parents
6c193625
1e1d70b2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
merkledag/merkledag_test.go
merkledag/merkledag_test.go
+1
-1
merkledag/node.go
merkledag/node.go
+4
-4
No files found.
merkledag/merkledag_test.go
View file @
29862f02
...
...
@@ -122,7 +122,7 @@ func SubtestNodeStat(t *testing.T, n *Node) {
return
}
if
expected
!=
actual
{
if
expected
!=
*
actual
{
t
.
Error
(
"n.Stat incorrect.
\n
expect: %s
\n
actual: %s"
,
expected
,
actual
)
}
else
{
fmt
.
Printf
(
"n.Stat correct: %s
\n
"
,
actual
)
...
...
merkledag/node.go
View file @
29862f02
...
...
@@ -160,18 +160,18 @@ func (n *Node) Size() (uint64, error) {
}
// Stat returns statistics on the node.
func
(
n
*
Node
)
Stat
()
(
NodeStat
,
error
)
{
func
(
n
*
Node
)
Stat
()
(
*
NodeStat
,
error
)
{
enc
,
err
:=
n
.
Encoded
(
false
)
if
err
!=
nil
{
return
NodeStat
{}
,
err
return
nil
,
err
}
cumSize
,
err
:=
n
.
Size
()
if
err
!=
nil
{
return
NodeStat
{}
,
err
return
nil
,
err
}
return
NodeStat
{
return
&
NodeStat
{
NumLinks
:
len
(
n
.
Links
),
BlockSize
:
len
(
enc
),
LinksSize
:
len
(
enc
)
-
len
(
n
.
Data
),
// includes framing.
...
...
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