From 047bae63d0f7337c9fa279154cc17ad8ea83d14f Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 4 Sep 2020 12:16:08 +0300 Subject: [PATCH] [#135] sdk/object: Fix IDFromV2 nil-behavior Remove nil if-statement from IDFromV2 function to which avoids checking the correctness of the identifier format. From now IDFromV2 returns format error on nil argument. Signed-off-by: Leonard Lyubich --- pkg/object/id.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/pkg/object/id.go b/pkg/object/id.go index 437f2d4..f7a3a1f 100644 --- a/pkg/object/id.go +++ b/pkg/object/id.go @@ -37,10 +37,6 @@ func (id *ID) ToV2() *refs.ObjectID { // Returns an error if the format of the identifier // in the message is broken. func IDFromV2(idV2 *refs.ObjectID) (*ID, error) { - if idV2 == nil { - return nil, nil - } - val := idV2.GetValue() if ln := len(val); ln != sha256.Size { return nil, errors.Errorf("could not convert %T to %T: invalid length %d",