Skip to content

Commit

Permalink
appease codeclimate
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
  • Loading branch information
whyrusleeping committed Dec 4, 2017
1 parent 1a75c40 commit 76e4dcf
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions unixfs/hamt/hamt.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,35 +501,35 @@ func (ds *HamtShard) modifyValue(ctx context.Context, hv *hashBits, key string,

child.val = val
return nil
} else {
if val == nil {
return os.ErrNotExist
}
}

// replace value with another shard, one level deeper
ns, err := NewHamtShard(ds.dserv, ds.tableSize)
if err != nil {
return err
}
ns.prefix = ds.prefix
chhv := &hashBits{
b: hash([]byte(child.key)),
consumed: hv.consumed,
}
if val == nil {
return os.ErrNotExist
}

err = ns.modifyValue(ctx, hv, key, val)
if err != nil {
return err
}
// replace value with another shard, one level deeper
ns, err := NewHamtShard(ds.dserv, ds.tableSize)
if err != nil {
return err
}
ns.prefix = ds.prefix
chhv := &hashBits{
b: hash([]byte(child.key)),
consumed: hv.consumed,
}

err = ns.modifyValue(ctx, chhv, child.key, child.val)
if err != nil {
return err
}
err = ns.modifyValue(ctx, hv, key, val)
if err != nil {
return err
}

ds.setChild(cindex, ns)
return nil
err = ns.modifyValue(ctx, chhv, child.key, child.val)
if err != nil {
return err
}

ds.setChild(cindex, ns)
return nil
default:
return fmt.Errorf("unexpected type for child: %#v", child)
}
Expand Down

0 comments on commit 76e4dcf

Please sign in to comment.