Commit 2f6bea5f authored by zramsay's avatar zramsay

apply the megacheck tool to improve code quality

License: MIT
Signed-off-by: default avatarZach Ramsay <zach.ramsay@gmail.com>
parent 9947834f
......@@ -12,12 +12,10 @@ import (
offline "github.com/ipfs/go-ipfs/exchange/offline"
ipldcbor "gx/ipfs/QmNrbCt8j9DT5W9Pmjy2SdudT9k8GpaDr4sRuFix3BXhgR/go-ipld-cbor"
logging "gx/ipfs/QmSpJByNKFX1sCsHBEp3R73FL4NF6FnQTEGyNAXHm2GS52/go-log"
cid "gx/ipfs/QmYhQaCYEcaPPjxJX7YcPcVKkQfRy6sJ7B3XmGFk82XYdQ/go-cid"
node "gx/ipfs/Qmb3Hm9QDFmfYuET4pu7Kyg8JV78jFa1nvZx5vnCZsK4ck/go-ipld-format"
)
var log = logging.Logger("merkledag")
var ErrNotFound = fmt.Errorf("merkledag: not found")
// DAGService is an IPFS Merkle DAG service.
......
......@@ -209,12 +209,6 @@ func runBatchFetchTest(t *testing.T, read io.Reader) {
}
}
func assertCanGet(t *testing.T, ds DAGService, n node.Node) {
if _, err := ds.Get(context.Background(), n.Cid()); err != nil {
t.Fatal(err)
}
}
func TestCantGet(t *testing.T) {
ds := dstest.Mock()
a := NodeWithData([]byte("A"))
......
......@@ -215,9 +215,8 @@ func (n *ProtoNode) SetData(d []byte) {
// that. If a link of the same name existed, it is removed.
func (n *ProtoNode) UpdateNodeLink(name string, that *ProtoNode) (*ProtoNode, error) {
newnode := n.Copy().(*ProtoNode)
err := newnode.RemoveNodeLink(name)
err = nil // ignore error
err = newnode.AddNodeLink(name, that)
_ = newnode.RemoveNodeLink(name) // ignore error
err := newnode.AddNodeLink(name, that)
return newnode, err
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment