From 7817c1afacad93b2b3122fd497ee5b7394007a73 Mon Sep 17 00:00:00 2001 From: Igor Vasilcovsky Date: Mon, 4 May 2015 16:33:48 -0400 Subject: [PATCH] Print errors to stderr. Check interval flag for valid value --- main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 02464bd..bdf9503 100644 --- a/main.go +++ b/main.go @@ -32,7 +32,12 @@ func main() { } } if len(ports) == 0 { - fmt.Println("no ports specified. Use -ports arg to specify ports of Go apps to monitor") + fmt.Fprintln(os.Stderr, "no ports specified. Use -ports arg to specify ports of Go apps to monitor") + Usage() + os.Exit(1) + } + if *interval <= 0 { + fmt.Fprintln(os.Stderr, "update interval is not valid. Valid examples: 5s, 1m, 1h30m") Usage() os.Exit(1) }