Commit 2a5d5cf4 authored by Daniel Martí's avatar Daniel Martí

linking/cid: check a previously unused error

As spotted by staticcheck. While at it, remove punctuation from another
couple of errors, as per
https://github.com/golang/go/wiki/CodeReviewComments#error-strings:

	Error strings should not be capitalized (unless beginning with
	proper nouns or acronyms) or end with punctuation, since they
	are usually printed following other context.
parent 8567f995
......@@ -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