Received: from out0.migadu.com (out0.migadu.com [94.23.1.103]) by mail-b.sr.ht (Postfix) with ESMTPS id 6B086FF0F0 for <~sircmpwn/chartsrv-devel@lists.sr.ht>; Thu, 24 Sep 2020 18:27:09 +0000 (UTC) Authentication-Results: mail-b.sr.ht; dkim=fail reason="key not found in DNS" (0-bit key) header.d=pixelhero.dev header.i=@pixelhero.dev header.b=mWjTe9Qu X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pixelhero.dev; s=key1; t=1600972028; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=7RhEk4GgEVElIOd+3ka9HCXE6SyPu36K3zz8HNc3Y74=; b=mWjTe9Quj1mYiawNDDBm0Z5ceUVnosKuE1esDQLGEmIGMV1zrcUOVu1HvEQqd3bxG0fceQ kPSYAGOC9rE2/T73UOOtvbr0xnFElUaUQiUZiyxEw6jnVESRByAp95Vf4Pw9rxq2CrxmmB WcXDGmABVUqXFc/iU69f55fKBTNz+fGUO9TKOmTA4TFxXm16kOR2u01oFcCLNSQ7Xv6hAr DnptzUiSMj1ZhGRqGzB+2gOlqclr4zQZxSYODhhieiZJlTCRGf20jalXiu+zJTKhNw6UWQ h9DCSbzYHSP6BDl+GCfstepPOkbDuwJTD1yKuuNHcyhrj/TFnLU1bPq0oba9mA== From: Noam Preil To: ~sircmpwn/chartsrv-devel@lists.sr.ht Cc: Noam Preil Subject: [PATCH] Error out instead of crashing when server isn't specified Date: Thu, 24 Sep 2020 14:23:43 -0400 Message-Id: <20200924182343.9291-1-noam@pixelhero.dev> MIME-Version: 1.0 X-Spam-Score: 0.00 Content-Transfer-Encoding: quoted-printable --- main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.go b/main.go index e15d079..887ae50 100644 --- a/main.go +++ b/main.go @@ -128,6 +128,10 @@ func metricName(metric map[string]string) string { func main() { plotutil.DefaultDashes =3D [][]vg.Length{{}} =20 + if len(os.Args) < 2 { + fmt.Printf("Usage: %s server\n", os.Args[0]) + os.Exit(1) + } upstream =3D os.Args[1] router :=3D chi.NewRouter() router.Use(middleware.RealIP) --=20 2.28.0