From ef048bb856619fd570ed47cf9c48676df924b499 Mon Sep 17 00:00:00 2001 From: Yogesh Deshpande Date: Mon, 5 Feb 2024 13:57:43 -0500 Subject: [PATCH] Some more fixes! Signed-off-by: Yogesh Deshpande --- comid/integrityregisters.go | 10 +++++----- comid/integrityregisters_test.go | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/comid/integrityregisters.go b/comid/integrityregisters.go index e2581d9b..0c72d810 100644 --- a/comid/integrityregisters.go +++ b/comid/integrityregisters.go @@ -100,12 +100,12 @@ func (i *IntegrityRegisters) UnmarshalJSON(data []byte) error { for key, val := range jmap { index, err := unmarshalIndex(key) if err != nil { - return fmt.Errorf("unable to unMarshal index: %w", err) + return fmt.Errorf("unable to unmarshal index: %w", err) } var d Digests if err = json.Unmarshal(val, &d); err != nil { - return fmt.Errorf("unable to UnMarshal Digests: %w", err) + return fmt.Errorf("unable to unmarshal Digests: %w", err) } if err = i.AddDigests(index, d); err != nil { return fmt.Errorf("unable to insert register into register set: %w", err) @@ -117,19 +117,19 @@ func (i *IntegrityRegisters) UnmarshalJSON(data []byte) error { func unmarshalIndex(key string) (IRegisterIndex, error) { var v tnv if err := json.Unmarshal([]byte(key), &v); err != nil { - return nil, fmt.Errorf("unable to unMarshal key: %w", err) + return nil, fmt.Errorf("unable to unmarshal key: %w", err) } switch v.Type { case "uint": var key uint if err := json.Unmarshal(v.Value, &key); err != nil { - return nil, fmt.Errorf("unable to unMarshal uint key: %w", err) + return nil, fmt.Errorf("unable to unmarshal uint key: %w", err) } return key, nil case "text": var key string if err := json.Unmarshal(v.Value, &key); err != nil { - return nil, fmt.Errorf("unable to unMarshal uint key: %w", err) + return nil, fmt.Errorf("unable to unmarshal uint key: %w", err) } return key, nil default: diff --git a/comid/integrityregisters_test.go b/comid/integrityregisters_test.go index 9cb67305..bb7ed9ff 100644 --- a/comid/integrityregisters_test.go +++ b/comid/integrityregisters_test.go @@ -183,12 +183,12 @@ func TestIntegrityRegisters_UnmarshalJSON_InvalidIndex(t *testing.T) { { Name: "invalid input integer", Input: `{"{\"type\":\"int\",\"value\":0}":["sha-384;MTI0MzU0NjU4Njk3OTA4MDEyNDM1NDY1ODY5NzkwODAxMjQzNTQ2NTg2OTc5MDgw"]}`, - Err: "unable to unMarshal index: invalid type: int", + Err: "unable to unmarshal index: invalid type: int", }, { Name: "invalid type", Input: `{"{abcd}":["sha-384;MTI0MzU0NjU4Njk3OTA4MDEyNDM1NDY1ODY5NzkwODAxMjQzNTQ2NTg2OTc5MDgw"]}`, - Err: `unable to unMarshal index: unable to unMarshal key: invalid character 'a' looking for beginning of object key string`, + Err: `unable to unmarshal index: unable to unmarshal key: invalid character 'a' looking for beginning of object key string`, }, } { t.Run(tv.Name, func(t *testing.T) {