From d2d169411319b97af95ec533b29684c438aefe54 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 17 Jun 2022 12:05:00 +0300 Subject: [PATCH] [#1513] cli/storagegroup: Fix linter remarks `staticcheck` linter scolds on potential nil-dereference since it doesn't know `common.ExitOnErr` definitely exists. Explicit `return` fixes linter's remark and prevents potential bugs. Signed-off-by: Leonard Lyubich --- cmd/neofs-cli/modules/storagegroup/util.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/neofs-cli/modules/storagegroup/util.go b/cmd/neofs-cli/modules/storagegroup/util.go index 2fefb5ba..4fd4c2f0 100644 --- a/cmd/neofs-cli/modules/storagegroup/util.go +++ b/cmd/neofs-cli/modules/storagegroup/util.go @@ -25,6 +25,7 @@ func readCID(cmd *cobra.Command, id *cid.ID) { f := cmd.Flag(flag) if f == nil { common.ExitOnErr(cmd, "", fmt.Errorf("missing container flag (%s)", flag)) + return } err := id.DecodeString(f.Value.String()) @@ -37,6 +38,7 @@ func readSGID(cmd *cobra.Command, id *oid.ID) { f := cmd.Flag(flag) if f == nil { common.ExitOnErr(cmd, "", fmt.Errorf("missing storage group flag (%s)", flag)) + return } err := id.DecodeString(f.Value.String())