From 970b28ec302df6952619347112ab8980820c137c Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sun, 8 Dec 2024 02:19:11 +0900 Subject: [PATCH] updated argument check for 'version' --- cmd/main.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index 93a2c45..3395c80 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -219,9 +219,8 @@ func main() { var err error var flgs *flag.FlagSet - if len(os.Args) < 2 { - goto wrong_usage - } + if len(os.Args) < 2 { goto wrong_usage } + if strings.EqualFold(os.Args[1], "server") { var rpc_addrs[] string var ctl_addrs[] string @@ -251,9 +250,7 @@ func main() { goto wrong_usage } - if len(rpc_addrs) <= 0 || flgs.NArg() > 0 { - goto wrong_usage - } + if len(rpc_addrs) <= 0 || flgs.NArg() > 0 { goto wrong_usage } if (cfgfile != "") { cfg, err = load_server_config(cfgfile) @@ -299,9 +296,7 @@ func main() { goto wrong_usage } - if len(rpc_addrs) <= 0 { - goto wrong_usage - } + if len(rpc_addrs) <= 0 { goto wrong_usage } if (cfgfile != "") { cfg, err = load_client_config(cfgfile) @@ -319,6 +314,7 @@ func main() { goto oops } } else if strings.EqualFold(os.Args[1], "version") { + if len(os.Args) != 2 { goto wrong_usage } fmt.Printf("%s %s\n", HODU_NAME, HODU_VERSION) } else { goto wrong_usage