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-merkledag
Commits
9e4c9b93
Commit
9e4c9b93
authored
Aug 30, 2018
by
dignifiedquire
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use more idiomatic append version
parent
fc8b2d42
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
7 deletions
+5
-7
node.go
node.go
+5
-7
No files found.
node.go
View file @
9e4c9b93
...
@@ -127,14 +127,12 @@ func (n *ProtoNode) AddRawLink(name string, l *ipld.Link) error {
...
@@ -127,14 +127,12 @@ func (n *ProtoNode) AddRawLink(name string, l *ipld.Link) error {
func
(
n
*
ProtoNode
)
RemoveNodeLink
(
name
string
)
error
{
func
(
n
*
ProtoNode
)
RemoveNodeLink
(
name
string
)
error
{
n
.
encoded
=
nil
n
.
encoded
=
nil
ref
:=
&
n
.
links
ref
:=
n
.
links
[
:
0
]
filterPos
:=
0
found
:=
false
found
:=
false
for
i
:=
0
;
i
<
len
(
*
ref
);
i
++
{
for
_
,
v
:=
range
n
.
links
{
if
v
:=
(
*
ref
)[
i
];
v
.
Name
!=
name
{
if
v
.
Name
!=
name
{
(
*
ref
)[
filterPos
]
=
v
ref
=
append
(
ref
,
v
)
filterPos
++
}
else
{
}
else
{
found
=
true
found
=
true
}
}
...
@@ -144,7 +142,7 @@ func (n *ProtoNode) RemoveNodeLink(name string) error {
...
@@ -144,7 +142,7 @@ func (n *ProtoNode) RemoveNodeLink(name string) error {
return
ipld
.
ErrNotFound
return
ipld
.
ErrNotFound
}
}
n
.
links
=
(
*
ref
)[
:
filterPos
]
n
.
links
=
ref
return
nil
return
nil
}
}
...
...
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