From f86fd9e366394631bcc7780270654ed2818688d1 Mon Sep 17 00:00:00 2001 From: Yogesh Deshpande Date: Tue, 6 Feb 2024 08:21:11 -0500 Subject: [PATCH] Minor tidy ups Signed-off-by: Yogesh Deshpande --- comid/integrityregisters.go | 6 +++--- comid/integrityregisters_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/comid/integrityregisters.go b/comid/integrityregisters.go index fa934fa5..1daf3cf0 100644 --- a/comid/integrityregisters.go +++ b/comid/integrityregisters.go @@ -107,16 +107,16 @@ func (i *IntegrityRegisters) UnmarshalJSON(data []byte) error { var d Digests if err := json.Unmarshal(val, &ktv); err != nil { - return fmt.Errorf("unable to unmarshal keyvalue: %w", err) + return fmt.Errorf("unable to unmarshal keyTypeAndValue: %w", err) } if err := json.Unmarshal(ktv.Value, &d); err != nil { - return fmt.Errorf("unable to unmarshal Digest: %w", err) + return fmt.Errorf("unable to unmarshal Digests: %w", err) } switch ktv.KeyType { case UintType: u, err := strconv.Atoi(key) if err != nil { - return fmt.Errorf("unable to convert key to uint: %v", err) + return fmt.Errorf("unable to convert key to uint: %w", err) } else if u < 0 { return fmt.Errorf("invalid negative integer key") } diff --git a/comid/integrityregisters_test.go b/comid/integrityregisters_test.go index 84e5c215..f8a3279a 100644 --- a/comid/integrityregisters_test.go +++ b/comid/integrityregisters_test.go @@ -201,7 +201,7 @@ func TestIntegrityRegisters_UnmarshalJSON_NOK(t *testing.T) { { Name: "invalid digest", Input: `{"1":{"key_type":"uint","Value":["sha-256;5Fty9cDAtXLbTY06t+l/3TmI0eoJN7LZ6hOUiTXU="]}}`, - Err: `unable to unmarshal Digest: illegal base64 data at input byte 40`, + Err: `unable to unmarshal Digests: illegal base64 data at input byte 40`, }, } { t.Run(tv.Name, func(t *testing.T) {