[#1592] cmd: Ignore error when fetching a defined flag

There is an error only if the flag is not defined, such errors should be
caught during debugging.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2022-07-13 10:33:07 +03:00 committed by fyrchik
parent f7d5045876
commit b8508585a5
2 changed files with 4 additions and 4 deletions

View file

@ -50,8 +50,8 @@ func Execute() error {
}
func entryPoint(cmd *cobra.Command, args []string) error {
printVersion, err := cmd.Flags().GetBool("version")
if err == nil && printVersion {
printVersion, _ := cmd.Flags().GetBool("version")
if printVersion {
cmd.Print(misc.BuildInfo("NeoFS Adm"))
return nil
}

View file

@ -19,8 +19,8 @@ var command = &cobra.Command{
}
func entryPoint(cmd *cobra.Command, _ []string) error {
printVersion, err := cmd.Flags().GetBool("version")
if err == nil && printVersion {
printVersion, _ := cmd.Flags().GetBool("version")
if printVersion {
cmd.Print(misc.BuildInfo("NeoFS Lens"))
return nil