[#174] Use Marshal(JSON)/Unmarshal(JSON) methods for encoding/decoding

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-11-16 13:26:35 +03:00 committed by Alex Vanin
parent 3de8febe57
commit 58fcb35fb0
22 changed files with 91 additions and 140 deletions

View file

@ -3,7 +3,6 @@ package cmd
import (
"context"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"io"
@ -628,9 +627,9 @@ func marshalHeader(cmd *cobra.Command, hdr *object.Object) ([]byte, error) {
case toJson && toProto:
return nil, errors.New("'--json' and '--proto' flags are mutually exclusive")
case toJson:
return json.Marshal(hdr) // TODO currently not supported by neofs-api-go
return hdr.MarshalJSON()
case toProto:
return hdr.ToV2().StableMarshal(nil)
return hdr.Marshal()
default:
return nil, nil
}