From 637077a8838d01c0061c834cee29985d0d3554fd Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 15 Feb 2022 08:54:42 +0300 Subject: [PATCH] [#1181] CLI: Simplify object type output There is no need to switch between object types since `Type` implements `fmt.Stringer`. Replace swich-case in `printHeader` with `%s` format notation function. Signed-off-by: Leonard Lyubich --- cmd/neofs-cli/modules/object.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/cmd/neofs-cli/modules/object.go b/cmd/neofs-cli/modules/object.go index ce9f52ccf6..67b0cea78a 100644 --- a/cmd/neofs-cli/modules/object.go +++ b/cmd/neofs-cli/modules/object.go @@ -861,16 +861,7 @@ func printHeader(cmd *cobra.Command, obj *object.Object) error { cmd.Printf("Size: %d\n", obj.PayloadSize()) cmd.Printf("HomoHash: %s\n", hex.EncodeToString(obj.PayloadHomomorphicHash().Sum())) cmd.Printf("Checksum: %s\n", hex.EncodeToString(obj.PayloadChecksum().Sum())) - switch obj.Type() { - case object.TypeRegular: - cmd.Println("Type: regular") - case object.TypeTombstone: - cmd.Println("Type: tombstone") - case object.TypeStorageGroup: - cmd.Println("Type: storage group") - default: - cmd.Println("Type: unknown") - } + cmd.Printf("Type: %s\n", obj.Type()) cmd.Println("Attributes:") for _, attr := range obj.Attributes() {