From 9261699745a337b64cf51c6ec5d2a578e532b6c7 Mon Sep 17 00:00:00 2001 From: Michael Shaw Date: Thu, 19 Jan 2023 17:30:47 -0500 Subject: [PATCH] unchecked error complaint from linter --- utils/json.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/utils/json.go b/utils/json.go index 2c47181f..59746c29 100644 --- a/utils/json.go +++ b/utils/json.go @@ -70,10 +70,13 @@ func CIDFromJSONBytesUsingIpldPrime(content []byte) (string, error) { //This is combination of samples for unmarshalling and linking //see: https://pkg.go.dev/github.com/ipld/go-ipld-prime - np := basicnode.Prototype.Any // Pick a stle for the in-memory data. - nb := np.NewBuilder() // Create a builder. - dagjson.Decode(nb, bytes.NewReader(content)) // Hand the builder to decoding -- decoding will fill it in! - n := nb.Build() // Call 'Build' to get the resulting Node. (It's immutable!) + np := basicnode.Prototype.Any // Pick a stle for the in-memory data. + nb := np.NewBuilder() // Create a builder. + err := dagjson.Decode(nb, bytes.NewReader(content)) // Hand the builder to decoding -- decoding will fill it in! + if err != nil { + return "", err + } + n := nb.Build() // Call 'Build' to get the resulting Node. (It's immutable!) lsys := cidlink.DefaultLinkSystem()