Unverified Commit 8c54f51a authored by Eric Myhre's avatar Eric Myhre Committed by GitHub

Merge pull request #68 from mvdan/unused-error

linking/cid: check a previously unused error
parents 30e4b351 2a5d5cf4
......@@ -137,7 +137,7 @@ func marshal(n ipld.Node, tk *tok.Token, sink shared.TokenSink) error {
tk.Tagged = false
return err
default:
return fmt.Errorf("schemafree link emission only supported by this codec for CID type links!")
return fmt.Errorf("schemafree link emission only supported by this codec for CID type links")
}
default:
panic("unreachable")
......
......@@ -147,7 +147,7 @@ func Marshal(n ipld.Node, sink shared.TokenSink) error {
}
return nil
default:
return fmt.Errorf("schemafree link emission only supported by this codec for CID type links!")
return fmt.Errorf("schemafree link emission only supported by this codec for CID type links")
}
default:
panic("unreachable")
......
......@@ -84,6 +84,9 @@ func (lb LinkBuilder) Build(ctx context.Context, lnkCtx ipld.LinkContext, node i
return nil, err
}
cid, err := lb.Prefix.Sum(hasher.Bytes())
if err != nil {
return nil, err
}
lnk := Link{cid}
if err := commit(lnk); err != nil {
return lnk, 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