From 833dcb07f6e228ed0dab31f25598052911697a76 Mon Sep 17 00:00:00 2001 From: Josh Deprez Date: Mon, 4 Jan 2021 10:43:04 +1100 Subject: [PATCH] die if webserver dies --- main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 4b2e090..35bd8ad 100644 --- a/main.go +++ b/main.go @@ -139,7 +139,9 @@ func main() { client := modbus.NewClient(handler) scrape(client) // Start http interface only after first successful scrape - go http.ListenAndServe(*httpAddr, nil) + go func() { + die("http.ListenAndServe: %v", http.ListenAndServe(*httpAddr, nil)) + }() for range time.Tick(*scrapeInterval) { scrape(client) }